diff options
| author | Duncan Sands <baldrick@free.fr> | 2008-04-07 13:43:58 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2008-04-07 13:43:58 +0000 |
| commit | 1416ebf1fe56290cfc1e91e0aba71b93c0c275bc (patch) | |
| tree | c80bc7b5ccbc36789fa63e38d1d825c18cb57cdb /llvm/lib/Transforms | |
| parent | fbc6adcc599905fbb95f2b1794b47c53e382c102 (diff) | |
| download | bcm5719-llvm-1416ebf1fe56290cfc1e91e0aba71b93c0c275bc.tar.gz bcm5719-llvm-1416ebf1fe56290cfc1e91e0aba71b93c0c275bc.zip | |
The "stacksave is not nounwind problem" no longer
needs to be fixed here - a previous commit made sure
that intrinsics always get the right attributes.
So remove no-longer needed code, and while there use
Intrinsic::getDeclaration rather than getOrInsertFunction.
llvm-svn: 49337
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 5e56c4e4516..ff494ce8af4 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -347,12 +347,10 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG, const TargetData *TD) { // code with llvm.stacksave/llvm.stackrestore intrinsics. if (InlinedFunctionInfo.ContainsDynamicAllocas) { Module *M = Caller->getParent(); - const Type *BytePtr = PointerType::getUnqual(Type::Int8Ty); // Get the two intrinsics we care about. Constant *StackSave, *StackRestore; - StackSave = M->getOrInsertFunction("llvm.stacksave", BytePtr, NULL); - StackRestore = M->getOrInsertFunction("llvm.stackrestore", Type::VoidTy, - BytePtr, NULL); + StackSave = Intrinsic::getDeclaration(M, Intrinsic::stacksave); + StackRestore = Intrinsic::getDeclaration(M, Intrinsic::stackrestore); // If we are preserving the callgraph, add edges to the stacksave/restore // functions for the calls we insert. @@ -368,14 +366,12 @@ 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); } @@ -388,8 +384,7 @@ 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 *CI = CallInst::Create(StackRestore, SavedPtr, "", UI); - CI->setDoesNotThrow(); + CallInst::Create(StackRestore, SavedPtr, "", UI); ++NumStackRestores; } } |

