diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-19 18:22:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-19 18:22:06 +0000 |
commit | c56c8453778cc070feee78f4a80fe85f6aa2d85c (patch) | |
tree | 8e894b3252e1c6ab107107534eb7ba4f01c5aad9 /llvm/test/Transforms/InstCombine/overflow.ll | |
parent | 713ab3796512498b5f4e6ed79ea2ff4e6aa8df9b (diff) | |
download | bcm5719-llvm-c56c8453778cc070feee78f4a80fe85f6aa2d85c.tar.gz bcm5719-llvm-c56c8453778cc070feee78f4a80fe85f6aa2d85c.zip |
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.
llvm-svn: 122177
Diffstat (limited to 'llvm/test/Transforms/InstCombine/overflow.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/overflow.ll | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/llvm/test/Transforms/InstCombine/overflow.ll b/llvm/test/Transforms/InstCombine/overflow.ll index e54d315cd04..da20e2c983d 100644 --- a/llvm/test/Transforms/InstCombine/overflow.ll +++ b/llvm/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 +} |