@@ -10213,15 +10213,19 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1021310213 // of a loop-defined variable, but it ignores induction variables which are
1021410214 // handled by InnerLoopVectorizer::fixupIVUsers. We need to bail out if we
1021510215 // encounter induction variables too otherwise fixupIVUsers will crash.
10216- for (BasicBlock *BB : L->blocks ()) {
10217- for (Instruction &I : *BB) {
10218- for (User *U : I.users ()) {
10216+ BasicBlock *LoopLatch = L->getLoopLatch ();
10217+ for (const auto &Induction : LVL.getInductionVars ()) {
10218+ PHINode *Ind = Induction.first ;
10219+ Instruction *IndUpdate =
10220+ cast<Instruction>(Ind->getIncomingValueForBlock (LoopLatch));
10221+ for (Instruction *I : {cast<Instruction>(Ind), IndUpdate}) {
10222+ for (User *U : I->users ()) {
1021910223 Instruction *UI = cast<Instruction>(U);
1022010224 if (!L->contains (UI)) {
1022110225 reportVectorizationFailure (
10222- " Auto-vectorization of loops with uncountable "
10223- " early exit and live-outs is not supported " ,
10224- " UncountableEarlyExitLoopLiveOutsUnsupported " , ORE, L);
10226+ " Auto-vectorization of loops with uncountable early exits and "
10227+ " outside uses of induction variables unsupported " ,
10228+ " UncountableEarlyExitLoopIndLiveOutsUnsupported " , ORE, L);
1022510229 return false ;
1022610230 }
1022710231 }
0 commit comments