[llvm-commits] [poolalloc] r130201 - /poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Tue Apr 26 08:43:49 PDT 2011
Author: aggarwa4
Date: Tue Apr 26 10:43:49 2011
New Revision: 130201
URL: http://llvm.org/viewvc/llvm-project?rev=130201&view=rev
Log:
Do not change functions that have byval arguments. Is
causing some attribute problems.
Modified:
poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp
Modified: poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp?rev=130201&r1=130200&r2=130201&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/StructReturnToPointer.cpp Tue Apr 26 10:43:49 2011
@@ -78,7 +78,6 @@
// Create the new function body and insert it into the module.
Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName(), &M);
- NF->copyAttributesFrom(F);
DenseMap<const Value*, Value*> ValueMap;
Function::arg_iterator NI = NF->arg_begin();
NI->setName("ret");
@@ -96,7 +95,7 @@
ae= NF->arg_end(); ai != ae; ++ai) {
fargs.push_back(ai);
}
- NF->setAlignment(F->getAlignment());
+ NF->setAlignment(F->getAlignment());
for (Function::iterator B = NF->begin(), FE = NF->end(); B != FE; ++B) {
for (BasicBlock::iterator I = B->begin(), BE = B->end(); I != BE;) {
ReturnInst * RI = dyn_cast<ReturnInst>(I++);
@@ -115,9 +114,11 @@
continue;
if(CI->getCalledFunction() != F)
continue;
+ if(CI->hasByValArgument())
+ continue;
AllocaInst *AllocaNew = new AllocaInst(F->getReturnType(), 0, "", CI);
SmallVector<Value*, 8> Args;
-
+
Args.push_back(AllocaNew);
for(unsigned j =1;j<CI->getNumOperands();j++) {
Args.push_back(CI->getOperand(j));
More information about the llvm-commits
mailing list