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

Tobias Grosser grosser at fim.uni-passau.de
Fri Mar 2 07:20:31 PST 2012


Author: grosser
Date: Fri Mar  2 09:20:31 2012
New Revision: 151915

URL: http://llvm.org/viewvc/llvm-project?rev=151915&view=rev
Log:
CodeGen: Prettify

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=151915&r1=151914&r2=151915&view=diff
==============================================================================
--- polly/trunk/lib/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGeneration.cpp Fri Mar  2 09:20:31 2012
@@ -277,11 +277,10 @@
   if (!OpInst)
     return const_cast<Value*>(OldOperand);
 
-  // IVS and Parameters.
+  // OldOperand was redefined outside of this BasicBlock.
   if (VMap.count(OldOperand)) {
     Value *NewOperand = VMap[OldOperand];
 
-    // Insert a cast if types are different
     if (OldOperand->getType()->getScalarSizeInBits()
         < NewOperand->getType()->getScalarSizeInBits())
       NewOperand = Builder.CreateTruncOrBitCast(NewOperand,
@@ -290,18 +289,17 @@
     return NewOperand;
   }
 
-  // Instructions calculated in the current BB.
+  // OldOperand was recalculated within this BasicBlock.
   if (BBMap.count(OldOperand)) {
     return BBMap[OldOperand];
   }
 
-  // Ignore instructions that are referencing ops in the old BB. These
-  // instructions are unused. They where replace by new ones during
-  // createIndependentBlocks().
-  if (S.getRegion().contains(OpInst->getParent()))
-    return NULL;
+  // OldOperand is SCoP invariant.
+  if (!S.getRegion().contains(OpInst->getParent()))
+    return const_cast<Value*>(OldOperand);
 
-  return const_cast<Value*>(OldOperand);
+  // We could not find any valid new operand.
+  return NULL;
 }
 
 void BlockGenerator::copyInstScalar(const Instruction *Inst, ValueMapT &BBMap) {





More information about the llvm-commits mailing list