[llvm] [LoopVectorize] Add metadata to distinguish vectorized loop body from scalar remainder (PR #190258)
Adel Ejjeh via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 3 08:53:41 PDT 2026
================
@@ -25,13 +25,25 @@ static void warnAboutLeftoverTransformations(Loop *L,
OptimizationRemarkEmitter *ORE) {
if (hasUnrollTransformation(L) == TM_ForcedByUser) {
LLVM_DEBUG(dbgs() << "Leftover unroll transformation\n");
- ORE->emit(
- DiagnosticInfoOptimizationFailure(DEBUG_TYPE,
- "FailedRequestedUnrolling",
- L->getStartLoc(), L->getHeader())
- << "loop not unrolled: the optimizer was unable to perform the "
- "requested transformation; the transformation might be disabled or "
- "specified as part of an unsupported transformation ordering");
+ bool IsVectorBody =
+ getBooleanLoopAttribute(L, "llvm.loop.vectorize.vector_body");
+ bool IsScalarRemainder =
+ getBooleanLoopAttribute(L, "llvm.loop.vectorize.scalar_remainder");
+ const char *LoopKind = (IsVectorBody && IsScalarRemainder)
+ ? "epilogue vectorized remainder loop"
+ : IsScalarRemainder
+ ? "scalar remainder loop after vectorization"
+ : IsVectorBody ? "vectorized loop"
+ : "loop";
+ std::string Msg =
+ std::string(LoopKind) +
+ " not unrolled: the optimizer was unable to perform the "
+ "requested transformation; the transformation might be disabled "
+ "or specified as part of an unsupported transformation ordering";
----------------
adelejjeh wrote:
The diagnosticinfo constructor being used (the one that takes a PassName instead of a Function) does not take a Twine argument. But I think I addressed your concern.
https://github.com/llvm/llvm-project/pull/190258
More information about the llvm-commits
mailing list