[LV] Cleanup: Sink an IRBuilder closer to its uses.
authorJames Molloy <james.molloy@arm.com>
Wed, 2 Sep 2015 10:15:27 +0000 (10:15 +0000)
committerJames Molloy <james.molloy@arm.com>
Wed, 2 Sep 2015 10:15:27 +0000 (10:15 +0000)
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246635 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Vectorize/LoopVectorize.cpp

index de0f1f0179da6c129358e3751f6de197ca6ea8ac..6d4a134aa670ca9e67e8e16e86644b8d622211aa 100644 (file)
@@ -2881,12 +2881,6 @@ void InnerLoopVectorizer::createEmptyLoop() {
     createInductionVariable(Lp, StartIdx, CountRoundDown, Step,
                             getDebugLocFromInstOrOperands(OldInduction));
 
-  // This is the IR builder that we use to add all of the logic for bypassing
-  // the new vector loop.
-  IRBuilder<> BypassBuilder(LoopBypassBlocks.back()->getTerminator());
-  setDebugLocFromInst(BypassBuilder,
-                      getDebugLocFromInstOrOperands(OldInduction));
-
   // We are going to resume the execution of the scalar loop.
   // Go over all of the induction variables that we found and fix the
   // PHIs that are left in the scalar version of the loop.
@@ -2920,10 +2914,11 @@ void InnerLoopVectorizer::createEmptyLoop() {
       // We also know which PHI node holds it.
       ResumeIndex = ResumeVal;
     } else {
-      Value *CRD = BypassBuilder.CreateSExtOrTrunc(CountRoundDown,
-                                                   II.getStepValue()->getType(),
-                                                   "cast.crd");
-      EndValue = II.transform(BypassBuilder, CRD);
+      IRBuilder<> B(LoopBypassBlocks.back()->getTerminator());
+      Value *CRD = B.CreateSExtOrTrunc(CountRoundDown,
+                                       II.getStepValue()->getType(),
+                                       "cast.crd");
+      EndValue = II.transform(B, CRD);
       EndValue->setName("ind.end");
     }