1 ; RUN: opt < %s -reassociate -constprop -instcombine -dce -S | FileCheck %s
3 ; With sub reassociation, constant folding can eliminate all of the constants.
4 define i32 @test1(i32 %A, i32 %B) {
6 ; CHECK-NEXT: %Z = sub i32 %A, %B
7 ; CHECK-NEXT: ret i32 %Z
16 ; With sub reassociation, constant folding can eliminate the two 12 constants.
17 define i32 @test2(i32 %A, i32 %B, i32 %C, i32 %D) {
19 ; CHECK-NEXT: %sum = add i32 %A, %B
20 ; CHECK-NEXT: %sum1 = add i32 %sum, %C
21 ; CHECK-NEXT: %Q = sub i32 %D, %sum1
22 ; CHECK-NEXT: ret i32 %Q