diff options
author | Chris Lattner <sabre@nondot.org> | 2008-06-25 05:59:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-06-25 05:59:28 +0000 |
commit | aa0bf52625447ec3ce29c94393f946c58475aa60 (patch) | |
tree | 77bb839581c40e0413b2039d3a0b2356a3f19a8c /lib/Transforms/Scalar | |
parent | 601ca4b434f5c67503a30575cc36b688b0d959e6 (diff) | |
download | llvm-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.cpp | 13 |
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); } } |