summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-25 05:59:28 +0000
committerChris Lattner <sabre@nondot.org>2008-06-25 05:59:28 +0000
commitaa0bf52625447ec3ce29c94393f946c58475aa60 (patch)
tree77bb839581c40e0413b2039d3a0b2356a3f19a8c /lib/Transforms/Scalar
parent601ca4b434f5c67503a30575cc36b688b0d959e6 (diff)
downloadllvm-aa0bf52625447ec3ce29c94393f946c58475aa60.tar.gz
llvm-aa0bf52625447ec3ce29c94393f946c58475aa60.tar.bz2
llvm-aa0bf52625447ec3ce29c94393f946c58475aa60.tar.xz
Fix PR2488, a case where we deleted stack restores too aggressively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52702 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 37637bbe63..d45eb99d93 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -8697,13 +8697,18 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
CannotRemove = true;
break;
}
- if (isa<CallInst>(BI)) {
- if (!isa<IntrinsicInst>(BI)) {
+ if (CallInst *BCI = dyn_cast<CallInst>(BI)) {
+ if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(BCI)) {
+ // If there is a stackrestore below this one, remove this one.
+ if (II->getIntrinsicID() == Intrinsic::stackrestore)
+ return EraseInstFromFunction(CI);
+ // Otherwise, ignore the intrinsic.
+ } else {
+ // If we found a non-intrinsic call, we can't remove the stack
+ // restore.
CannotRemove = true;
break;
}
- // If there is a stackrestore below this one, remove this one.
- return EraseInstFromFunction(CI);
}
}