summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-02-27 00:53:54 +0000
committerReid Kleckner <rnk@google.com>2016-02-27 00:53:54 +0000
commit892ae2e2b65004c22e3cfbfe4e1c44717f4214d0 (patch)
tree8f790053fb18158932f1d62bd2ded712cd31b761 /llvm/lib
parentf91b1639505183a88b147012068776abf53a37cd (diff)
downloadbcm5719-llvm-892ae2e2b65004c22e3cfbfe4e1c44717f4214d0.tar.gz
bcm5719-llvm-892ae2e2b65004c22e3cfbfe4e1c44717f4214d0.zip
[InstCombine] Be more conservative about removing stackrestore
We ended up removing a save/restore pair around an inalloca call, leading to a miscompile in Chromium. llvm-svn: 262095
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index fbbe29cfe5b..bd58e81bc91 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1821,7 +1821,13 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
// If there is a stackrestore below this one, remove this one.
if (II->getIntrinsicID() == Intrinsic::stackrestore)
return eraseInstFromFunction(CI);
- // Otherwise, ignore the intrinsic.
+
+ // Bail if we cross over an intrinsic with side effects, such as
+ // llvm.stacksave, llvm.read_register, or llvm.setjmp.
+ if (II->mayHaveSideEffects()) {
+ CannotRemove = true;
+ break;
+ }
} else {
// If we found a non-intrinsic call, we can't remove the stack
// restore.
OpenPOWER on IntegriCloud