[Mlir-commits] [mlir] [MLIR][SCFToOpenMP] Fix crash when lowering vector reductions (PR #173978)

Tom Eccles llvmlistbot at llvm.org
Mon Jan 5 08:04:17 PST 2026


================
@@ -261,54 +295,67 @@ static omp::DeclareReductionOp declareReduction(PatternRewriter &builder,
   // Match simple binary reductions that can be expressed with atomicrmw.
   Type type = reduce.getOperands()[reductionIndex].getType();
   Block &reduction = reduce.getReductions()[reductionIndex].front();
+
+  // Handle scalar element type extraction for vector bitwidth safety.
+  Type elType = type;
+  if (auto vecType = dyn_cast<VectorType>(type))
+    elType = vecType.getElementType();
----------------
tblah wrote:

nit: perhaps this should be a helper function, as the same pattern repeats a lot.

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


More information about the Mlir-commits mailing list