blob: 2136e094253e5a89db175e769c1dca452989aa62 [file] [log] [blame]
Chris Lattnerd88f3e82002-05-15 21:59:31 +00001; With sub reassociation, constant folding can eliminate all of the constants.
2;
Chris Lattnera6fee9d2003-06-28 23:23:34 +00003; RUN: as < %s | opt -reassociate -constprop -instcombine -dce | dis | not grep add
Chris Lattnerd88f3e82002-05-15 21:59:31 +00004
Chris Lattnera6fee9d2003-06-28 23:23:34 +00005int %test(int %A, int %B) {
Chris Lattnera5d9be12002-05-16 00:56:36 +00006 %W = add int 5, %B
Chris Lattnerd88f3e82002-05-15 21:59:31 +00007 %X = add int -7, %A
8 %Y = sub int %X, %W
9 %Z = add int %Y, 12
10 ret int %Z
11}