mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
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. llvm-svn: 49299
This commit is contained in:
parent
5a1f254f0a
commit
5c2c09c01b
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user