llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
388 stars 99 forks source link

Reinstate #1007 equality of array types #1178

Open bcardosolopes opened 2 days ago

bcardosolopes commented 2 days ago

_Originally posted by @bcardosolopes in https://github.com/llvm/clangir/pull/1166#discussion_r1861314776_

bcardosolopes commented 2 days ago

cc @ChuanqiXu9

ChuanqiXu9 commented 2 days ago

Some detailed description:

In https://github.com/llvm/clangir/pull/1166, we disabled to check for the equality of array element types for the following issue:

In an array of unions (or types containing unions), we may construct an array attribute from the initializers. However, the type of the initializers may be different for unions. https://github.com/llvm/clangir/pull/1007 is another try to solve the problem but it shows it is not easy to fix it fundamentally without introducing two type systems: one for code gen for CIR and one for lowering CIR. See the comments in https://github.com/llvm/clangir/pull/1160#issuecomment-2499675263 for detailed analysis.