summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-11-28 23:32:19 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-11-28 23:32:19 +0000
commitb3f9b0676a7970a6fe4bbb0b8f67f765e6ccc85a (patch)
tree7218388226c802ded54e2de9c509658e22c72421 /llvm/test/Transforms
parent44cb7b635438174a90e112c3ed36dae7710f176c (diff)
downloadbcm5719-llvm-b3f9b0676a7970a6fe4bbb0b8f67f765e6ccc85a.tar.gz
bcm5719-llvm-b3f9b0676a7970a6fe4bbb0b8f67f765e6ccc85a.zip
Add a missing safety check to ProcessUGT_ADDCST_ADD. Fixes PR11438.
llvm-svn: 145316
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/overflow.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/overflow.ll b/llvm/test/Transforms/InstCombine/overflow.ll
index 9123283988d..81ceef8c41c 100644
--- a/llvm/test/Transforms/InstCombine/overflow.ll
+++ b/llvm/test/Transforms/InstCombine/overflow.ll
@@ -130,4 +130,26 @@ entry:
ret i64 %Q
}
+; CHECK: @test8
+; PR11438
+; This is @test1, but the operands are not sign-extended. Make sure
+; we don't transform this case.
+define i32 @test8(i64 %a, i64 %b) nounwind ssp {
+entry:
+; CHECK-NOT: llvm.sadd
+; CHECK: add i64 %a, %b
+; CHECK-NOT: llvm.sadd
+; CHECK: ret
+ %add = add i64 %a, %b
+ %add.off = add i64 %add, 2147483648
+ %0 = icmp ugt i64 %add.off, 4294967295
+ br i1 %0, label %if.then, label %if.end
+
+if.then:
+ tail call void @throwAnExceptionOrWhatever() nounwind
+ br label %if.end
+if.end:
+ %conv9 = trunc i64 %add to i32
+ ret i32 %conv9
+}
OpenPOWER on IntegriCloud