diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-11 21:46:48 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-11 21:46:48 +0000 |
commit | 1800d823de1ec72d827f12ca340d5ca2d2a81510 (patch) | |
tree | 880138d29849fb4f4f46845d2d58f56fb3738c62 /llvm/test/Transforms | |
parent | 7936a8a488c8f967cf42b9b5ef8c30b3a989e345 (diff) | |
download | bcm5719-llvm-1800d823de1ec72d827f12ca340d5ca2d2a81510.tar.gz bcm5719-llvm-1800d823de1ec72d827f12ca340d5ca2d2a81510.zip |
Also fold (A+B) == A -> B == 0 when the add is commuted.
llvm-svn: 125411
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r-- | llvm/test/Transforms/InstCombine/add.ll | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/add.ll b/llvm/test/Transforms/InstCombine/add.ll index b3a7f526079..a316d06894a 100644 --- a/llvm/test/Transforms/InstCombine/add.ll +++ b/llvm/test/Transforms/InstCombine/add.ll @@ -276,18 +276,26 @@ define i32 @test36(i32 %a) { ret i32 %q } -define i32 @test37(i32 %a, i32 %b) nounwind readnone { -entry: - %add = add nsw i32 %a, %b +define i1 @test37(i32 %a, i32 %b) nounwind readnone { + %add = add i32 %a, %b %cmp = icmp eq i32 %add, %a - %conv = zext i1 %cmp to i32 - ret i32 %conv + ret i1 %cmp } -define i32 @test38(i32 %a, i32 %b) nounwind readnone { -entry: - %add = add nsw i32 %a, %b +define i1 @test38(i32 %a, i32 %b) nounwind readnone { + %add = add i32 %a, %b + %cmp = icmp eq i32 %add, %b + ret i1 %cmp +} + +define i1 @test39(i32 %a, i32 %b) nounwind readnone { + %add = add i32 %b, %a %cmp = icmp eq i32 %add, %a - %conv = zext i1 %cmp to i32 - ret i32 %conv + ret i1 %cmp +} + +define i1 @test40(i32 %a, i32 %b) nounwind readnone { + %add = add i32 %b, %a + %cmp = icmp eq i32 %add, %b + ret i1 %cmp } |