[llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp DeadArgumentElimination.cpp PruneEH.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun May 8 18:06:04 PDT 2005
Changes in directory llvm/lib/Transforms/IPO:
ArgumentPromotion.cpp updated: 1.19 -> 1.20
DeadArgumentElimination.cpp updated: 1.23 -> 1.24
PruneEH.cpp updated: 1.21 -> 1.22
---
Log message:
Preserve calling conventions when doing IPO
---
Diffs of the changes: (+13 -5)
ArgumentPromotion.cpp | 6 +++++-
DeadArgumentElimination.cpp | 3 +++
PruneEH.cpp | 9 +++++----
3 files changed, 13 insertions(+), 5 deletions(-)
Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.19 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.20
--- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.19 Fri May 6 01:46:52 2005
+++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Sun May 8 20:05:50 2005
@@ -394,6 +394,7 @@
// Create the new function body and insert it into the module...
Function *NF = new Function(NFTy, F->getLinkage(), F->getName());
+ NF->setCallingConv(F->getCallingConv());
F->getParent()->getFunctionList().insert(F, NF);
// Get the alias analysis information that we need to update to reflect our
@@ -411,7 +412,8 @@
// Loop over the operands, inserting GEP and loads in the caller as
// appropriate.
CallSite::arg_iterator AI = CS.arg_begin();
- for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI)
+ for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
+ I != E; ++I, ++AI)
if (!ArgsToPromote.count(I))
Args.push_back(*AI); // Unmodified argument
else if (!I->use_empty()) {
@@ -441,8 +443,10 @@
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
Args, "", Call);
+ cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
} else {
New = new CallInst(NF, Args, "", Call);
+ cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}
Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.23 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.24
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.23 Fri May 6 01:46:52 2005
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Sun May 8 20:05:50 2005
@@ -400,6 +400,7 @@
// Create the new function body and insert it into the module...
Function *NF = new Function(NFTy, F->getLinkage(), F->getName());
+ NF->setCallingConv(F->getCallingConv());
F->getParent()->getFunctionList().insert(F, NF);
// Loop over all of the callers of the function, transforming the call sites
@@ -428,8 +429,10 @@
if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) {
New = new InvokeInst(NF, II->getNormalDest(), II->getUnwindDest(),
Args, "", Call);
+ cast<InvokeInst>(New)->setCallingConv(CS.getCallingConv());
} else {
New = new CallInst(NF, Args, "", Call);
+ cast<CallInst>(New)->setCallingConv(CS.getCallingConv());
if (cast<CallInst>(Call)->isTailCall())
cast<CallInst>(New)->setTailCall();
}
Index: llvm/lib/Transforms/IPO/PruneEH.cpp
diff -u llvm/lib/Transforms/IPO/PruneEH.cpp:1.21 llvm/lib/Transforms/IPO/PruneEH.cpp:1.22
--- llvm/lib/Transforms/IPO/PruneEH.cpp:1.21 Wed Apr 27 15:12:17 2005
+++ llvm/lib/Transforms/IPO/PruneEH.cpp Sun May 8 20:05:50 2005
@@ -144,10 +144,11 @@
if (DoesNotUnwind.count(CG[F])) {
// Insert a call instruction before the invoke...
std::string Name = II->getName(); II->setName("");
- Value *Call = new CallInst(II->getCalledValue(),
- std::vector<Value*>(II->op_begin()+3,
- II->op_end()),
- Name, II);
+ CallInst *Call = new CallInst(II->getCalledValue(),
+ std::vector<Value*>(II->op_begin()+3,
+ II->op_end()),
+ Name, II);
+ Call->setCallingConv(II->getCallingConv());
// Anything that used the value produced by the invoke instruction
// now uses the value produced by the call instruction.
More information about the llvm-commits
mailing list