Chris Lattner | 4846b31 | 2008-02-17 20:51:26 +0000 | [diff] [blame] | 1 | ; With sub reassociation, constant folding can eliminate the uses of %a. |
| 2 | ; |
Dan Gohman | 3c7d308 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 3 | ; RUN: opt < %s -reassociate -instcombine -S | grep %a | count 1 |
Chris Lattner | 4846b31 | 2008-02-17 20:51:26 +0000 | [diff] [blame] | 4 | ; PR2047 |
| 5 | |
| 6 | define i32 @test(i32 %a, i32 %b, i32 %c) nounwind { |
| 7 | entry: |
| 8 | %tmp3 = sub i32 %a, %b ; <i32> [#uses=1] |
| 9 | %tmp5 = sub i32 %tmp3, %c ; <i32> [#uses=1] |
| 10 | %tmp7 = sub i32 %tmp5, %a ; <i32> [#uses=1] |
| 11 | ret i32 %tmp7 |
| 12 | } |
| 13 | |