blob: 34b943cf496deaac6328d2bd20c7a1c428b73121 [file] [log] [blame]
Owen Anderson8373d332014-10-05 23:41:26 +00001; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
2
3; Test that we can turn things like A*B + X - A*B -> X.
4
5define i32 @test1(i32 %a, i32 %b, i32 %x) {
6; CHECK-LABEL: test1
7; CHECK: ret i32 %x
8
9 %c = mul i32 %a, %b
10 %d = add i32 %c, %x
11 %c1 = mul i32 %a, %b
12 %f = sub i32 %d, %c1
13 ret i32 %f
14}
15