Chris Lattner | d88f3e8 | 2002-05-15 21:59:31 +0000 | [diff] [blame] | 1 | ; With sub reassociation, constant folding can eliminate all of the constants. |
| 2 | ; |
| 3 | ; RUN: if as < %s | opt -reassociate -constprop -instcombine -dce | dis | grep add |
| 4 | ; RUN: then exit 1 |
| 5 | ; RUN: else exit 0 |
| 6 | ; RUN: fi |
| 7 | |
| 8 | int "test"(int %A, int %B) { |
Chris Lattner | a5d9be1 | 2002-05-16 00:56:36 +0000 | [diff] [blame] | 9 | %W = add int 5, %B |
Chris Lattner | d88f3e8 | 2002-05-15 21:59:31 +0000 | [diff] [blame] | 10 | %X = add int -7, %A |
| 11 | %Y = sub int %X, %W |
| 12 | %Z = add int %Y, 12 |
| 13 | ret int %Z |
| 14 | } |