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 | ; |
Reid Spencer | d0e30dc | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 3 | ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -dce | llvm-dis | not grep add |
Chris Lattner | d88f3e8 | 2002-05-15 21:59:31 +0000 | [diff] [blame] | 4 | |
Chris Lattner | a6fee9d | 2003-06-28 23:23:34 +0000 | [diff] [blame] | 5 | int %test(int %A, int %B) { |
Chris Lattner | a5d9be1 | 2002-05-16 00:56:36 +0000 | [diff] [blame] | 6 | %W = add int 5, %B |
Chris Lattner | d88f3e8 | 2002-05-15 21:59:31 +0000 | [diff] [blame] | 7 | %X = add int -7, %A |
| 8 | %Y = sub int %X, %W |
| 9 | %Z = add int %Y, 12 |
| 10 | ret int %Z |
| 11 | } |