[Mlir-commits] [mlir] Fix crash when using when using --finalize-memref-to-llvm (PR #112433)

Krzysztof Drewniak llvmlistbot at llvm.org
Wed Oct 23 08:17:36 PDT 2024


================
@@ -527,8 +527,11 @@ LLVMTypeConverter::getMemRefAddressSpace(BaseMemRefType type) const {
     return failure();
   if (!(*converted)) // Conversion to default is 0.
     return 0;
-  if (auto explicitSpace = llvm::dyn_cast_if_present<IntegerAttr>(*converted))
-    return explicitSpace.getInt();
+  if (auto explicitSpace = dyn_cast_if_present<IntegerAttr>(*converted)) {
+    if (explicitSpace.getType().isIndex() ||
----------------
krzysz00 wrote:

Could we instead change this to get the integer out of `uiN` attributes instead?

If not, this is reasonably approved

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


More information about the Mlir-commits mailing list