[Mlir-commits] [mlir] [mlir][spirv] Fix a crash of typeConverter with non supported type (PR #79955)

Jakub Kuderski llvmlistbot at llvm.org
Tue Jan 30 08:05:24 PST 2024


================
@@ -367,12 +367,13 @@ class AccessChainPattern : public SPIRVToLLVMConversion<spirv::AccessChainOp> {
     Value zero = rewriter.create<LLVM::ConstantOp>(
         op.getLoc(), llvmIndexType, rewriter.getIntegerAttr(indexType, 0));
     indices.insert(indices.begin(), zero);
-    rewriter.replaceOpWithNewOp<LLVM::GEPOp>(
-        op, dstType,
-        typeConverter.convertType(
-            cast<spirv::PointerType>(op.getBasePtr().getType())
-                .getPointeeType()),
-        adaptor.getBasePtr(), indices);
+
+    auto elementType = typeConverter.convertType(
+        cast<spirv::PointerType>(op.getBasePtr().getType()).getPointeeType());
+    if (!elementType)
+      return failure();
----------------
kuhar wrote:

```suggestion
      return rewriter.notifyMatchFailure(op, "type conversion failed");
```

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


More information about the Mlir-commits mailing list