1 ; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
3 ; Test that we can turn things like X*-(Y*Z) -> X*-1*Y*Z.
5 define i32 @test1(i32 %a, i32 %b, i32 %z) {
7 ; CHECK-NEXT: %e = mul i32 %a, 12345
8 ; CHECK-NEXT: %f = mul i32 %e, %b
9 ; CHECK-NEXT: %g = mul i32 %f, %z
10 ; CHECK-NEXT: ret i32 %g
15 %f = mul i32 %e, 12345
20 define i32 @test2(i32 %a, i32 %b, i32 %z) {
22 ; CHECK-NEXT: %e = mul i32 %a, 40
23 ; CHECK-NEXT: %f = mul i32 %e, %z
24 ; CHECK-NEXT: ret i32 %f