Index: llvm/include/llvm/Analysis/VectorUtils.h =================================================================== --- llvm/include/llvm/Analysis/VectorUtils.h +++ llvm/include/llvm/Analysis/VectorUtils.h @@ -811,6 +811,9 @@ /// cannot be filtered by masking the load/store. void invalidateGroupsRequiringScalarEpilogue(); + /// Returns true if we have any interleave groups. + bool hasGroups() const { return !InterleaveGroups.empty(); } + private: /// A wrapper around ScalarEvolution, used to add runtime SCEV checks. /// Simplifies SCEV expressions in the context of existing SCEV assumptions. Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp =================================================================== --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -5051,7 +5051,7 @@ // Invalidate interleave groups that require an epilogue if we can't mask // the interleave-group. - if (!useMaskedInterleavedAccesses(TTI)) { + if (InterleaveInfo.hasGroups() && !useMaskedInterleavedAccesses(TTI)) { assert(WideningDecisions.empty() && Uniforms.empty() && Scalars.empty() && "No decisions should have been taken at this point"); // Note: There is no need to invalidate any cost modeling decisions here, as @@ -7448,7 +7448,8 @@ return None; // Invalidate interleave groups if all blocks of loop will be predicated. - if (CM.blockNeedsPredicationForAnyReason(OrigLoop->getHeader()) && + if (CM.InterleaveInfo.hasGroups() && + CM.blockNeedsPredicationForAnyReason(OrigLoop->getHeader()) && !useMaskedInterleavedAccesses(*TTI)) { LLVM_DEBUG( dbgs()