1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=reassociate < %s | FileCheck %s
4 define i32 @test(i1 %b) {
6 ; CHECK-NEXT: [[RES:%.*]] = callbr i32 asm "", "=r,!i"()
7 ; CHECK-NEXT: to label [[NORMAL:%.*]] [label %abnormal]
9 ; CHECK-NEXT: [[RES_NEG:%.*]] = sub i32 0, [[RES]]
10 ; CHECK-NEXT: [[SUB1:%.*]] = add i32 [[RES_NEG]], 5
11 ; CHECK-NEXT: [[RES_NEG1:%.*]] = sub i32 0, [[RES]]
12 ; CHECK-NEXT: [[SUB2:%.*]] = add i32 [[SUB1]], [[RES_NEG1]]
13 ; CHECK-NEXT: ret i32 [[SUB2]]
15 ; CHECK-NEXT: ret i32 0
17 %res = callbr i32 asm "", "=r,!i"()
18 to label %normal [label %abnormal]
21 %sub1 = sub nsw i32 5, %res
22 %sub2 = sub nsw i32 %sub1, %res