[llvm-commits] [llvm] r49337 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Duncan Sands
baldrick at free.fr
Mon Apr 7 06:43:58 PDT 2008
Author: baldrick
Date: Mon Apr 7 08:43:58 2008
New Revision: 49337
URL: http://llvm.org/viewvc/llvm-project?rev=49337&view=rev
Log:
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.
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=49337&r1=49336&r2=49337&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Mon Apr 7 08:43:58 2008
@@ -347,12 +347,10 @@
// 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 @@
// 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 @@
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;
}
}
More information about the llvm-commits
mailing list