blob: be204e92142d8dd65889d8e134af3d475c02fa52 [file] [log] [blame]
Chris Lattnerd88f3e82002-05-15 21:59:31 +00001; With sub reassociation, constant folding can eliminate all of the constants.
2;
Reid Spencerd0e30dc2006-12-02 04:23:10 +00003; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -dce | llvm-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}