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

Jakub Kuderski llvmlistbot at llvm.org
Thu Feb 6 06:22:25 PST 2025


================
@@ -306,16 +301,11 @@ struct VectorInsertOpConvert final
 
     if (std::optional<int64_t> id =
             getConstantIntValue(insertOp.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::InsertOp::kPoisonIndex) {
-        // Arbitrary choice of poison result, intended to stick out.
-        Value zero = spirv::ConstantOp::getZero(insertOp.getDestVectorType(),
-                                                insertOp.getLoc(), rewriter);
-        rewriter.replaceOp(insertOp, zero);
-      } else
-        rewriter.replaceOpWithNewOp<spirv::CompositeInsertOp>(
-            insertOp, adaptor.getSource(), adaptor.getDest(), id.value());
+      // Static use of the poison index is handled elsewhere (folded to poison).
+      if (id == vector::InsertOp::kPoisonIndex)
+        return failure();
----------------
kuhar wrote:

Same here

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


More information about the Mlir-commits mailing list