diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7531,7 +7531,7 @@ // Set P to nullptr to avoid re-analysis of phi node in // matchAssociativeReduction function unless this is the root node. P = nullptr; - if (Vectorize(Inst, R)) { + if (!isa(Inst) && Vectorize(Inst, R)) { Res = true; continue; } @@ -7543,7 +7543,8 @@ for (auto *Op : Inst->operand_values()) if (VisitedInstrs.insert(Op).second) if (auto *I = dyn_cast(Op)) - if (!isa(I) && !R.isDeleted(I) && I->getParent() == BB) + if (!isa(I) && !isa(I) && !R.isDeleted(I) && + I->getParent() == BB) Stack.emplace_back(I, Level); } return Res;