summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-04-07 13:43:58 +0000
committerDuncan Sands <baldrick@free.fr>2008-04-07 13:43:58 +0000
commit3d292aca0306fbb65da4622c80df01432ab6559b (patch)
treec86abca5a31f1818537268fa47e7832189a45dc1 /lib/Transforms/Utils/InlineFunction.cpp
parenta122043c2c0d33828cb2e897b43b5d858a74db4e (diff)
downloadllvm-3d292aca0306fbb65da4622c80df01432ab6559b.tar.gz
llvm-3d292aca0306fbb65da4622c80df01432ab6559b.tar.bz2
llvm-3d292aca0306fbb65da4622c80df01432ab6559b.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49337 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 5e56c4e451..ff494ce8af 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/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;
}
}