From 0e7f18791cfe23860ae590c8c7e1724f9aa0e23b Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 10 Dec 2024 10:39:27 +0000 Subject: [PATCH] [LV] Relax assertion in fixupIVUsers (NFC). 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 https://github.com/llvm/llvm-project/pull/112138. --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 32aacfaf4d76f5..de164ee434d647 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -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 MissingVals; Value *EndValue = cast(OrigPhi->getIncomingValueForBlock( @@ -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(I.first); // One corner case we have to handle is two IVs "chasing" each-other,