[llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Chris Lattner sabre at nondot.org
Wed Feb 7 11:31:51 PST 2007



Changes in directory llvm/lib/Transforms/IPO:

DeadArgumentElimination.cpp updated: 1.37 -> 1.38
---
Log message:

Fix Transforms/DeadArgElim/2007-02-07-FuncRename.ll, fallout from PR411: http://llvm.org/PR411 .
This happened because deadargelim now causes VMCore to auto-rename every 
function that it hacks arguments out of.  Because it hacks arguments out of
functions in a non-deterministic order, this caused the resultant numbering
to be nondet.  The fix is to just be careful to not rename functions!


---
Diffs of the changes:  (+4 -2)

 DeadArgumentElimination.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.37 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.38
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.37	Mon Feb  5 17:32:05 2007
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp	Wed Feb  7 13:31:33 2007
@@ -150,7 +150,8 @@
   unsigned NumArgs = Params.size();
   
   // Create the new function body and insert it into the module...
-  Function *NF = new Function(NFTy, Fn.getLinkage(), Fn.getName());
+  std::string Name = Fn.getName(); Fn.setName("");
+  Function *NF = new Function(NFTy, Fn.getLinkage(), Name);
   NF->setCallingConv(Fn.getCallingConv());
   Fn.getParent()->getFunctionList().insert(&Fn, NF);
   
@@ -508,7 +509,8 @@
   FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg());
 
   // Create the new function body and insert it into the module...
-  Function *NF = new Function(NFTy, F->getLinkage(), F->getName());
+  std::string Name = F->getName(); F->setName("");
+  Function *NF = new Function(NFTy, F->getLinkage(), Name);
   NF->setCallingConv(F->getCallingConv());
   F->getParent()->getFunctionList().insert(F, NF);
 






More information about the llvm-commits mailing list