[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:26 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();
----------------
kuhar wrote:
Maybe move the comment above to `return rewriter.notifyMatchFailure("reason");` so that this shows up in debug logs?
https://github.com/llvm/llvm-project/pull/125905
More information about the Mlir-commits
mailing list