Skip to content

Commit 4cf3bac

Browse files
committed
address review
1 parent a38e695 commit 4cf3bac

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

mlir/docs/TargetLLVMIR.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ be [bufferized](Bufferization.md) before being converted.
292292

293293
### Conversion of LLVM Container Types with Non-Compatible Element Types
294294

295-
Progressive lowering may result in there existing LLVM container types, such
295+
Progressive lowering may result in there LLVM container types, such
296296
as LLVM dialect structures, containing non-compatible types:
297297
`!llvm.struct<(index)>`. Such types are converted recursively using the rules
298298
described above.

mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,11 @@ LLVMTypeConverter::LLVMTypeConverter(MLIRContext *ctx,
113113
return success();
114114
}
115115

116-
// If it has been initialized and has the same body, just use it. This
117-
// ensures that recursive structs keep being recursive rather than
118-
// including a non-updated name.
119-
if (TypeRange(convertedType.getBody()) == TypeRange(convertedElemTypes)) {
116+
// If it has been initialized, has the same body and packed bit, just use
117+
// it. This ensures that recursive structs keep being recursive rather
118+
// than including a non-updated name.
119+
if (TypeRange(convertedType.getBody()) == TypeRange(convertedElemTypes) &&
120+
convertedType.isPacked() == type.isPacked()) {
120121
results.push_back(convertedType);
121122
return success();
122123
}

mlir/test/Conversion/LLVMCommon/types.mlir

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,15 @@ func.func private @create_clashes_on_conversion_recursive(!llvm.struct<"foo", (s
2121
// CHECK: @merge_on_conversion_recursive(!llvm.struct<"_Converted.foo", (struct<"_Converted.foo">, i64)>)
2222
func.func private @clashing_struct_name(!llvm.struct<"_Converted.foo", (struct<"_Converted.foo">, i64)>)
2323
func.func private @merge_on_conversion_recursive(!llvm.struct<"foo", (struct<"foo">, index)>)
24+
25+
// -----
26+
27+
// CHECK: @create_clashing_pack(!llvm.struct<"foo", packed (!llvm.struct<"foo">, index)>)
28+
func.func private @clashing_struct_name(!llvm.struct<"_Converted.foo", (struct<"_Converted.foo">, i64)>)
29+
func.func private @create_clashing_pack(!llvm.struct<"foo", packed (struct<"foo">, index)>)
30+
31+
// -----
32+
33+
// CHECK: @merge_on_conversion_pack(!llvm.struct<"_Converted.foo", packed (struct<"_Converted.foo">, i64)>)
34+
func.func private @clashing_struct_name(!llvm.struct<"_Converted.foo", packed (struct<"_Converted.foo">, i64)>)
35+
func.func private @merge_on_conversion_pack(!llvm.struct<"foo", packed (struct<"foo">, index)>)

0 commit comments

Comments
 (0)