aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-12-19 18:22:06 +0000
committerChris Lattner <sabre@nondot.org>2010-12-19 18:22:06 +0000
commitdd7e83737491b14ebf98e09fa6cb9b515f9f2e3e (patch)
treecdfd1a40046996f8fc5842e43ad4ffdf6d65d38b /test/Transforms/InstCombine
parentd959da92a5a479c7f8f4ccbf7a7e3fb87f9fda0c (diff)
downloadexternal_llvm-dd7e83737491b14ebf98e09fa6cb9b515f9f2e3e.zip
external_llvm-dd7e83737491b14ebf98e09fa6cb9b515f9f2e3e.tar.gz
external_llvm-dd7e83737491b14ebf98e09fa6cb9b515f9f2e3e.tar.bz2
fix another miscompile in the llvm.sadd formation logic: it wasn't
checking to see if the high bits of the original add result were dead. Inserting a smaller add and zexting back to that size is not good enough. This is likely to be the fix for 8816. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/overflow.ll23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/overflow.ll b/test/Transforms/InstCombine/overflow.ll
index e54d315..da20e2c 100644
--- a/test/Transforms/InstCombine/overflow.ll
+++ b/test/Transforms/InstCombine/overflow.ll
@@ -11,7 +11,7 @@ entry:
%conv2 = sext i32 %b to i64
%add = add nsw i64 %conv2, %conv
%add.off = add i64 %add, 2147483648
-; CHECK: llvm.sadd.with.overflow
+; CHECK: llvm.sadd.with.overflow.i32
%0 = icmp ugt i64 %add.off, 4294967295
br i1 %0, label %if.then, label %if.end
@@ -53,3 +53,24 @@ if.end:
ret i32 %conv9
}
+; CHECK: test3
+; This is illegal to transform because the high bits of the original add are
+; live out.
+define i64 @test3(i32 %a, i32 %b) nounwind ssp {
+entry:
+ %conv = sext i32 %a to i64
+ %conv2 = sext i32 %b to i64
+ %add = add nsw i64 %conv2, %conv
+ %add.off = add i64 %add, 2147483648
+; CHECK-NOT: llvm.sadd.with.overflow
+ %0 = icmp ugt i64 %add.off, 4294967295
+ br i1 %0, label %if.then, label %if.end
+
+if.then:
+ %call = tail call i32 (...)* @throwAnExceptionOrWhatever() nounwind
+ br label %if.end
+
+if.end:
+ ret i64 %add
+; CHECK: ret i64
+}