[Mlir-commits] [mlir] [mlir][spirv] Fix some issues related to converting ub.poison to SPIR-V (PR #125905)

Andrea Faulds llvmlistbot at llvm.org
Thu Feb 6 07:50:18 PST 2025


================
@@ -182,17 +182,12 @@ struct VectorExtractOpConvert final
 
     if (std::optional<int64_t> id =
             getConstantIntValue(extractOp.getMixedPosition()[0])) {
-      // TODO: ExtractOp::fold() already can fold a static poison index to
-      //       ub.poison; remove this once ub.poison can be converted to SPIR-V.
-      if (id == vector::ExtractOp::kPoisonIndex) {
-        // Arbitrary choice of poison result, intended to stick out.
-        Value zero =
-            spirv::ConstantOp::getZero(dstType, extractOp.getLoc(), rewriter);
-        rewriter.replaceOp(extractOp, zero);
-      } else
-        rewriter.replaceOpWithNewOp<spirv::CompositeExtractOp>(
-            extractOp, dstType, adaptor.getVector(),
-            rewriter.getI32ArrayAttr(id.value()));
+      // Static use of the poison index is handled elsewhere (folded to poison).
+      if (id == vector::ExtractOp::kPoisonIndex)
+        return failure();
----------------
andfau-amd wrote:

It doesn't show up in `-debug-only=pattern-application` or `-debug-only=dialect-conversion` for example.

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


More information about the Mlir-commits mailing list