- Expose passinfo from BreakCriticalEdges pass so that it may be "Required"
[oota-llvm.git] / lib / Transforms / Scalar / LICM.cpp
index 3714d7b08f4b4b1a7fdd7ed489cb6b0cdb724657..7bae9fd18a5a5b7ff8167f3f3b521c3d5cf8e7b6 100644 (file)
@@ -105,7 +105,6 @@ namespace {
     void visitShiftInst(ShiftInst &I) { visitBinaryOperator((Instruction&)I); }
 
     void visitLoadInst(LoadInst &LI) {
-      assert(!LI.hasIndices());
       if (isLoopInvariant(LI.getOperand(0)) &&
           !pointerInvalidatedByLoop(LI.getOperand(0)))
         hoist(LI);
@@ -242,10 +241,8 @@ void LICM::hoist(Instruction &Inst) {
     // No loop pre-header, insert a PHI node into header to capture all of the
     // incoming versions of the value.
     //
-    PHINode *LoopVal = new PHINode(Inst.getType(), InstName+".phi");
-
-    // Insert the new PHI node into the loop header...
-    Header->getInstList().push_front(LoopVal);
+    PHINode *LoopVal = new PHINode(Inst.getType(), InstName+".phi",
+                                   Header->begin());
 
     // Insert cloned versions of the instruction into all of the loop preds.
     for (unsigned i = 0, e = LoopPreds.size(); i != e; ++i) {