blob: dd6ddd9b62ec383785e09ae4e56bdc66d4380ec8 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -reassociate -instcombine -S |\
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002; RUN: not grep {sub i32 0}
3
Tanya Lattner028031a2008-03-19 04:36:04 +00004define i32 @test(i32 %X, i32 %Y, i32 %Z) {
5 %A = sub i32 0, %X ; <i32> [#uses=1]
6 %B = mul i32 %A, %Y ; <i32> [#uses=1]
7 ; (-X)*Y + Z -> Z-X*Y
8 %C = add i32 %B, %Z ; <i32> [#uses=1]
9 ret i32 %C
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010}