[llvm-commits] [llvm] r49299 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Dale Johannesen
dalej at apple.com
Sun Apr 6 17:08:49 PDT 2008
Author: johannes
Date: Sun Apr 6 19:08:48 2008
New Revision: 49299
URL: http://llvm.org/viewvc/llvm-project?rev=49299&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=49299&r1=49298&r2=49299&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sun Apr 6 19:08:48 2008
@@ -368,12 +368,14 @@
// 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 @@
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;
}
}
More information about the llvm-commits
mailing list