@@ -3409,14 +3409,7 @@ BasicBlock *InnerLoopVectorizer::completeLoopSkeleton(Loop *L,
3409
3409
Value *Count = getOrCreateTripCount (L);
3410
3410
Value *VectorTripCount = getOrCreateVectorTripCount (L);
3411
3411
3412
- // We need the OrigLoop (scalar loop part) latch terminator to help
3413
- // produce correct debug info for the middle block BB instructions.
3414
- // The legality check stage guarantees that the loop will have a single
3415
- // latch.
3416
- assert (isa<BranchInst>(OrigLoop->getLoopLatch ()->getTerminator ()) &&
3417
- " Scalar loop latch terminator isn't a branch" );
3418
- BranchInst *ScalarLatchBr =
3419
- cast<BranchInst>(OrigLoop->getLoopLatch ()->getTerminator ());
3412
+ auto *ScalarLatchTerm = OrigLoop->getLoopLatch ()->getTerminator ();
3420
3413
3421
3414
// Add a check in the middle block to see if we have completed
3422
3415
// all of the iterations in the first vector loop.
@@ -3428,16 +3421,16 @@ BasicBlock *InnerLoopVectorizer::completeLoopSkeleton(Loop *L,
3428
3421
VectorTripCount, " cmp.n" ,
3429
3422
LoopMiddleBlock->getTerminator ());
3430
3423
3431
- // Here we use the same DebugLoc as the scalar loop latch branch instead
3424
+ // Here we use the same DebugLoc as the scalar loop latch terminator instead
3432
3425
// of the corresponding compare because they may have ended up with
3433
3426
// different line numbers and we want to avoid awkward line stepping while
3434
3427
// debugging. Eg. if the compare has got a line number inside the loop.
3435
- cast<Instruction>(CmpN)->setDebugLoc (ScalarLatchBr ->getDebugLoc ());
3428
+ cast<Instruction>(CmpN)->setDebugLoc (ScalarLatchTerm ->getDebugLoc ());
3436
3429
}
3437
3430
3438
3431
BranchInst *BrInst =
3439
3432
BranchInst::Create (LoopExitBlock, LoopScalarPreHeader, CmpN);
3440
- BrInst->setDebugLoc (ScalarLatchBr ->getDebugLoc ());
3433
+ BrInst->setDebugLoc (ScalarLatchTerm ->getDebugLoc ());
3441
3434
ReplaceInstWithInst (LoopMiddleBlock->getTerminator (), BrInst);
3442
3435
3443
3436
// Get ready to start creating new instructions into the vectorized body.
0 commit comments