[llvm] [LoopVectorize] Add support for vectorisation of simple early exit loops (PR #88385)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 02:12:39 PDT 2024
================
@@ -3461,16 +3611,28 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State,
for (const auto &Entry : Legal->getInductionVars())
fixupIVUsers(Entry.first, Entry.second,
getOrCreateVectorTripCount(VectorLoop->getLoopPreheader()),
- IVEndValues[Entry.first], LoopMiddleBlock,
- VectorLoop->getHeader(), Plan, State);
+ IVEndValues[Entry.first], LoopMiddleBlock, Plan, State);
}
// Fix LCSSA phis not already fixed earlier. Extracts may need to be generated
// in the exit block, so update the builder.
+ BasicBlock *OrigEarlyExitBB = Legal->hasSpeculativeEarlyExit()
+ ? Legal->getSpeculativeEarlyExitBlock()
+ : nullptr;
+
State.Builder.SetInsertPoint(State.CFG.ExitBB,
State.CFG.ExitBB->getFirstNonPHIIt());
for (const auto &KV : Plan.getLiveOuts())
- KV.second->fixPhi(Plan, State);
+ if (OrigLoop->getUniqueExitBlock() ||
+ KV.second->getPhi()->getParent() != OrigEarlyExitBB)
+ KV.second->fixPhi(Plan, State);
----------------
david-arm wrote:
Sorry I missed this before - I'll take a look!
https://github.com/llvm/llvm-project/pull/88385
More information about the llvm-commits
mailing list