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

Kohei Yamaguchi llvmlistbot at llvm.org
Tue Jan 30 18:01:12 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();
----------------
sott0n wrote:

I followed it elsewhere at https://github.com/llvm/llvm-project/pull/79955/commits/ea81352d770087f789d610fc5ad1f45d7147def5

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


More information about the Mlir-commits mailing list