blob: 56e087a1fc75354a5d526680de6ea68e12e0bccf [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -instcombine | llvm-dis | not grep sub
2
3; Test that we can turn things like X*-(Y*Z) -> X*-1*Y*Z.
4
5int %test1(int %a, int %b, int %z) {
6 %c = sub int 0, %z
7 %d = mul int %a, %b
8 %e = mul int %c, %d
9 %f = mul int %e, 12345
10 %g = sub int 0, %f
11 ret int %g
12}
13
14int %test2(int %a, int %b, int %z) {
15 %d = mul int %z, 40
16 %c = sub int 0, %d
17 %e = mul int %a, %c
18 %f = sub int 0, %e
19 ret int %f
20}