[llvm] [LV] Bail out if loop nest contains non-widenable types. (PR #226463)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 04:05:30 PDT 2026


================
@@ -623,6 +639,23 @@ bool LoopVectorizationLegality::canVectorizeOuterLoop() {
   bool DoExtraAnalysis = ORE->allowExtraAnalysis(DEBUG_TYPE);
 
   for (BasicBlock *BB : TheLoop->blocks()) {
+    // Instructions in the loop nest are widened, so the types they produce and
+    // store must be widenable. Struct-returning calls are not supported yet.
+    for (Instruction &I : *BB) {
+      auto *SI = dyn_cast<StoreInst>(&I);
+      if (canWidenResultType(I, /*AllowStructCalls=*/false) &&
+          (!SI ||
+           VectorType::isValidElementType(SI->getValueOperand()->getType())))
+        continue;
+      reportVectorizationFailure("Found unvectorizable type",
+                                 "instruction type cannot be vectorized",
+                                 "CantVectorizeInstructionType", ORE, TheLoop,
----------------
fhahn wrote:

Thanks, I updated the code to share the logic to emit the remarks as well in both inner and outer loop paths

https://github.com/llvm/llvm-project/pull/226463


More information about the llvm-commits mailing list