[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 18:55:49 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:

Thanks @sott0n! This is very welcome but in the future it would be better to have similar improvements in a separate PR, so that it's easier to review bugfixes/new features without the noise of changes not related to that per se. In this instance it fine, I'd keep it as-is since you've already put everything together.

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


More information about the Mlir-commits mailing list