mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 08:56:06 +00:00

Existing implementation of the LLVM type converter for LLVM structs containing incompatible types was attempting to change identifiers of the struct in case of name clash post-conversion (all identified structs have different names post-conversion since one cannot change the body of the struct once initialized). Beyond a trivial error of not updating the counter in renaming, this approach was broken for recursive structs that can't be made aware of the renaming and would use the pre-existing struct with clashing name instead. For example, given `!llvm.struct<"_Converted.foo", (struct<"_Converted.foo">, f32)>` the following type `!llvm.struct<"foo", (struct<"foo", index>)>` would incorrectly convert to ``` !llvm.struct<"_Converted_1.foo", (struct<"_Converted.foo", (struct<"_Converted.foo">, f32)>)> ``` Remove this incorrect renaming and simply refuse to convert types if it would lead to identifier clashes for structs with different bodies. Document the expectation that such generated names are reserved and must not be present in the input IR of the converter. If we ever actually need to use handle such cases, this can be achieved by temporarily renaming structs with reserved identifiers to an unreserved name and back in a pre/post-processing pass that does _not_ use the type conversion infra.
MLIR documentation ================== Please note mlir.llvm.org is where MLIR's rendered documentation is displayed. The viewing experience on GitHub or elsewhere may not match those of the website. For any changes please verify instead that they work on the main website first. See https://github.com/llvm/mlir-www for the website generation information.