diff options
| author | Anders Carlsson <andersca@mac.com> | 2011-01-30 22:01:13 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2011-01-30 22:01:13 +0000 |
| commit | 77bc49e5e2e2a5e549d65bc0bedd86ff3df6b161 (patch) | |
| tree | 7f93923534f5f181e5ec3155cab6bbadc9d4caa9 /test/Transforms | |
| parent | 8352062e52eed6e50786fdb89f5e601fdcbe0d90 (diff) | |
Recognize and simplify
(A+B) == A -> B == 0
A == (A+B) -> B == 0
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124567 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
| -rw-r--r-- | test/Transforms/InstCombine/add.ll | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll index 4719809d6d..b3a7f52607 100644 --- a/test/Transforms/InstCombine/add.ll +++ b/test/Transforms/InstCombine/add.ll @@ -275,3 +275,19 @@ define i32 @test36(i32 %a) { %q = and i32 %z, 1 ; always zero ret i32 %q } + +define i32 @test37(i32 %a, i32 %b) nounwind readnone { +entry: + %add = add nsw i32 %a, %b + %cmp = icmp eq i32 %add, %a + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +define i32 @test38(i32 %a, i32 %b) nounwind readnone { +entry: + %add = add nsw i32 %a, %b + %cmp = icmp eq i32 %add, %a + %conv = zext i1 %cmp to i32 + ret i32 %conv +} |
