Skip to content

Commit 66b2820

Browse files
authored
[LoopVectorize] Remove redundant code in emitSCEVChecks (#111132)
There was some code in emitSCEVChecks to update the dominator tree if LoopBypassBlocks is empty, however there are no tests that fail when replacing this code with an assert. I built both SPEC2017 and the LLVM test suite and also didn't see any build failures. I've removed the code for now and added an assert to guard this in case anything changes, since it seems pointless to have code that's impossible to defend.
1 parent 924a64a commit 66b2820

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+2-12
Original file line numberDiff line numberDiff line change
@@ -2486,18 +2486,8 @@ BasicBlock *InnerLoopVectorizer::emitSCEVChecks(BasicBlock *Bypass) {
24862486
(OptForSizeBasedOnProfile &&
24872487
Cost->Hints->getForce() != LoopVectorizeHints::FK_Enabled)) &&
24882488
"Cannot SCEV check stride or overflow when optimizing for size");
2489-
2490-
2491-
// Update dominator only if this is first RT check.
2492-
if (LoopBypassBlocks.empty()) {
2493-
DT->changeImmediateDominator(Bypass, SCEVCheckBlock);
2494-
if (!Cost->requiresScalarEpilogue(VF.isVector()))
2495-
// If there is an epilogue which must run, there's no edge from the
2496-
// middle block to exit blocks and thus no need to update the immediate
2497-
// dominator of the exit blocks.
2498-
DT->changeImmediateDominator(LoopExitBlock, SCEVCheckBlock);
2499-
}
2500-
2489+
assert(!LoopBypassBlocks.empty() &&
2490+
"Should already be a bypass block due to iteration count check");
25012491
LoopBypassBlocks.push_back(SCEVCheckBlock);
25022492
AddedSafetyChecks = true;
25032493
return SCEVCheckBlock;

0 commit comments

Comments
 (0)