Skip to content

Commit

Permalink
[LV] Relax assertion in fixupIVUsers (NFC).
Browse files Browse the repository at this point in the history
Adjust the assertion in fixupIVUsers to only require a unique exit block
if there are any values to fix up. This enables the bring up of
multi-exit loop vectorization without requiring a scalar epilogue.

Split off as suggested from
#112138.
  • Loading branch information
fhahn committed Dec 10, 2024
1 parent d44518c commit 0e7f187
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2823,8 +2823,6 @@ void InnerLoopVectorizer::fixupIVUsers(PHINode *OrigPhi,
// value (the value that feeds into the phi from the loop latch).
// We allow both, but they, obviously, have different values.

assert(OrigLoop->getUniqueExitBlock() && "Expected a single exit block");

DenseMap<Value *, Value *> MissingVals;

Value *EndValue = cast<PHINode>(OrigPhi->getIncomingValueForBlock(
Expand Down Expand Up @@ -2878,6 +2876,9 @@ void InnerLoopVectorizer::fixupIVUsers(PHINode *OrigPhi,
}
}

assert((MissingVals.empty() || OrigLoop->getUniqueExitBlock()) &&
"Expected a single exit block for escaping values");

for (auto &I : MissingVals) {
PHINode *PHI = cast<PHINode>(I.first);
// One corner case we have to handle is two IVs "chasing" each-other,
Expand Down

0 comments on commit 0e7f187

Please sign in to comment.