[PATCH] D122471: [IR] Require intrinsic struct return type to be anonymous

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 26 15:19:46 PDT 2022


dexonsmith added a comment.

Thanks for thinking it over; SGTM. (I haven't reviewed details of this patch, but don't let my comment block landing it.)

In D122471#3409501 <https://reviews.llvm.org/D122471#3409501>, @nikic wrote:

> I think named types are primarily of interest if you can use different names for the "same" type, while this would limit you to one.

IMO, named types also add value when describing nested structures. E.g., this:

  declare {i32, {i32, {i32, i32}, {i32, i32}, i32}, i32, {i32, i32}} @thing2er()

is harder to read than this:

  %i32pair = {i32, i32}
  %thing1 = {i32, %i32pair, %i32pair, i32}
  %thing2 = {i32, %thing1, i32, %i32pair}
  
  declare %thing2 @thing2er()

IMO, after opaque pointers land, type names will just be helpful comments for debugging IR, like value names; not really a core part of the type system. But I take your point that it's useful to have multiple names for the same type. I'll keep thinking; maybe there's a good way to keep that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122471/new/

https://reviews.llvm.org/D122471



More information about the llvm-commits mailing list