aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-04-07 00:08:48 +0000
committerDale Johannesen <dalej@apple.com>2008-04-07 00:08:48 +0000
commit11b80a8e1c76c1ce25f471db900df626086fb39a (patch)
treeaf92faa075fc2b012cbca7b4e5183a5912efa64f
parente64d248b638831e0af4477fc04d42777445c424e (diff)
Mark calls to llvm.stacksave, llvm.stackrestore as
nounwind. When such calls are inlined into something else that is invoked, they were getting changed to invokes, which is badness. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49299 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 2e34984564..5e56c4e451 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -368,12 +368,14 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
// Insert the llvm.stacksave.
CallInst *SavedPtr = CallInst::Create(StackSave, "savedstack",
FirstNewBlock->begin());
+ SavedPtr->setDoesNotThrow();
if (CG) CallerNode->addCalledFunction(SavedPtr, StackSaveCGN);
// Insert a call to llvm.stackrestore before any return instructions in the
// inlined function.
for (unsigned i = 0, e = Returns.size(); i != e; ++i) {
CallInst *CI = CallInst::Create(StackRestore, SavedPtr, "", Returns[i]);
+ CI->setDoesNotThrow();
if (CG) CallerNode->addCalledFunction(CI, StackRestoreCGN);
}
@@ -386,7 +388,8 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) {
for (Function::iterator BB = FirstNewBlock, E = Caller->end();
BB != E; ++BB)
if (UnwindInst *UI = dyn_cast<UnwindInst>(BB->getTerminator())) {
- CallInst::Create(StackRestore, SavedPtr, "", UI);
+ CallInst *CI = CallInst::Create(StackRestore, SavedPtr, "", UI);
+ CI->setDoesNotThrow();
++NumStackRestores;
}
}