Add a missing safety check to ProcessUGT_ADDCST_ADD. Fixes PR11438.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145316 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman
2011-11-28 23:32:19 +00:00
parent 4544da484d
commit 54b92113e2
2 changed files with 30 additions and 0 deletions

View File

@ -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
}