Chris Lattner | 4544d02 | 2005-05-08 21:28:33 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | 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 | |||||
5 | int %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 | |||||
14 | int %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 | } |