1 ; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
3 ; With sub reassociation, constant folding can eliminate the 12 and -12 constants.
4 define i32 @test1(i32 %A, i32 %B) {
6 ; CHECK-NEXT: %Z = sub i32 %A, %B
7 ; CHECK-NEXT: ret i32 %Z
15 ; With sub reassociation, constant folding can eliminate the uses of %a.
16 define i32 @test2(i32 %a, i32 %b, i32 %c) nounwind {
18 ; CHECK-NEXT: %sum = add i32 %b, %c
19 ; CHECK-NEXT: %tmp7 = sub i32 0, %sum
20 ; CHECK-NEXT: ret i32 %tmp7
22 %tmp3 = sub i32 %a, %b
23 %tmp5 = sub i32 %tmp3, %c
24 %tmp7 = sub i32 %tmp5, %a