diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5000,6 +5000,8 @@ // then we calculate the cost of VF here. if (LoopCost == 0) LoopCost = expectedCost(VF).first; + if (LoopCost == 0) + return 1; // Clamp the calculated IC to be between the 1 and the max interleave count // that the target allows.