[llvm-commits] [polly] r139094 - /polly/trunk/lib/CodeGeneration.cpp

Tobias Grosser grosser at fim.uni-passau.de
Sun Sep 4 04:45:34 PDT 2011


Author: grosser
Date: Sun Sep  4 06:45:34 2011
New Revision: 139094

URL: http://llvm.org/viewvc/llvm-project?rev=139094&view=rev
Log:
CodeGeneration: Simplify code, fix style.

Modified:
    polly/trunk/lib/CodeGeneration.cpp

Modified: polly/trunk/lib/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=139094&r1=139093&r2=139094&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Sun Sep  4 06:45:34 2011
@@ -483,26 +483,23 @@
   }
 
   void copyInstScalar(const Instruction *Inst, ValueMapT &BBMap,
-                      ValueMapT &vectorMap, VectorValueMapT &scalarMaps) {
+                      ValueMapT &VectorMap) {
     Instruction *NewInst = Inst->clone();
 
-    // Copy the operands in temporary vector, as an in place update
-    // fails if an instruction is referencing the same operand twice.
-    std::vector<Value*> Operands(NewInst->op_begin(), NewInst->op_end());
-
     // Replace old operands with the new ones.
-    for (std::vector<Value*>::iterator UI = Operands.begin(),
-         UE = Operands.end(); UI != UE; ++UI) {
-      Value *newOperand = getOperand(*UI, BBMap);
+    for (Instruction::const_op_iterator OI = Inst->op_begin(),
+         OE = Inst->op_end(); OI != OE; ++OI) {
+      Value *OldOperand = *OI;
+      Value *NewOperand = getOperand(OldOperand, BBMap);
 
-      if (!newOperand) {
+      if (!NewOperand) {
         assert(!isa<StoreInst>(NewInst)
                && "Store instructions are always needed!");
         delete NewInst;
         return;
       }
 
-      NewInst->replaceUsesOfWith(*UI, newOperand);
+      NewInst->replaceUsesOfWith(OldOperand, NewOperand);
     }
 
     Builder.Insert(NewInst);
@@ -544,7 +541,7 @@
         return;
       }
 
-    copyInstScalar(Inst, BBMap, vectorMap, scalarMaps);
+    copyInstScalar(Inst, BBMap, vectorMap);
   }
 
   int getVectorSize() {





More information about the llvm-commits mailing list