[PATCH] D12286: [LV] Never widen an induction variable.

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 03:10:22 PDT 2015


jmolloy added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2683-2692
@@ -2682,12 +2693,12 @@
   } else {
     LI->addTopLevelLoop(Lp);
   }
   Lp->addBasicBlockToLoop(VecBody, *LI);
 
   // Use this IR builder to create the loop instructions (Phi, Br, Cmp)
   // inside the loop.
   Builder.SetInsertPoint(VecBody->getFirstNonPHI());
 
   // Generate the induction variable.
   setDebugLocFromInst(Builder, getDebugLocFromInstOrOperands(OldInduction));
   Induction = Builder.CreatePHI(IdxTy, 2, "index");
----------------
(now refers to L2174)

This is becoming dead as part of this patch. This is the patch that enforces that IdxTy is no different from Induction->getType(). The previous patch only enforced that Induction->getStart() == 0.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3416-3417
@@ -3470,4 +3415,4 @@
       VectorType::get(PN->getType(), VF);
       Entry[part] = PHINode::Create(VecTy, 2, "vec.phi",
                                     LoopVectorBody.back()-> getFirstInsertionPt());
     }
----------------
(Now refers to L3477)

Yes, it does. It's harmless, and I sometimes prefer to remove special-cases when they make no difference, but I've added the if back in because I think you're right, it makes the flow more obvious in this case.


Repository:
  rL LLVM

http://reviews.llvm.org/D12286





More information about the llvm-commits mailing list