[Mlir-commits] [mlir] [mlir][LLVM] Fix crash combining nested pointer data layouts (PR #222855)
Oscar Priego
llvmlistbot at llvm.org
Mon Sep 28 17:14:47 PDT 2026
https://github.com/Opriego updated https://github.com/llvm/llvm-project/pull/222855
>From 388d2a45589db43151ace35902a431729779c9a3 Mon Sep 17 00:00:00 2001
From: Oscar Priego Verdugo <oscar.priegov at gmail.com>
Date: Fri, 11 Sep 2026 00:34:50 -0600
Subject: [PATCH] [mlir][LLVM] Fix crash combining nested pointer data layouts
---
mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp | 4 ++--
mlir/test/Dialect/LLVMIR/layout.mlir | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
index 92df593860c01..be879f7fc4944 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypes.cpp
@@ -419,8 +419,8 @@ bool LLVMPointerType::areCompatible(
});
}
if (it != oldLayout.end()) {
- size = *extractPointerSpecValue(*it, PtrDLEntryPos::Size);
- abi = *extractPointerSpecValue(*it, PtrDLEntryPos::Abi);
+ size = *extractPointerSpecValue(it->getValue(), PtrDLEntryPos::Size);
+ abi = *extractPointerSpecValue(it->getValue(), PtrDLEntryPos::Abi);
}
Attribute newSpec = llvm::cast<DenseIntElementsAttr>(newEntry.getValue());
diff --git a/mlir/test/Dialect/LLVMIR/layout.mlir b/mlir/test/Dialect/LLVMIR/layout.mlir
index 2bdad3539a4f0..8f7021b25e15e 100644
--- a/mlir/test/Dialect/LLVMIR/layout.mlir
+++ b/mlir/test/Dialect/LLVMIR/layout.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt --test-data-layout-query --split-input-file --verify-diagnostics %s | FileCheck %s
+// RUN: mlir-opt --pass-pipeline='builtin.module(func.func(test-data-layout-query),builtin.module(func.func(test-data-layout-query)))' --split-input-file --verify-diagnostics %s | FileCheck %s
module {
// CHECK: @no_spec
@@ -173,6 +173,27 @@ module attributes { dlti.dl_spec = #dlti.dl_spec<
// -----
+module attributes { dlti.dl_spec = #dlti.dl_spec<
+ #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>
+>} {
+ module attributes { dlti.dl_spec = #dlti.dl_spec<
+ #dlti.dl_entry<!llvm.ptr, dense<64> : vector<4xi64>>
+ >} {
+ // CHECK-LABEL: @nested_pointer_layout
+ func.func @nested_pointer_layout() {
+ // CHECK: alignment = 8
+ // CHECK: bitsize = 64
+ // CHECK: index = 64
+ // CHECK: preferred = 8
+ // CHECK: size = 8
+ "test.data_layout_query"() : () -> !llvm.ptr
+ return
+ }
+ }
+}
+
+// -----
+
module {
// CHECK: @no_spec
func.func @no_spec() {
More information about the Mlir-commits
mailing list