[PATCH] D72323: OpaquePtr: print byval types containing anonymous types correctly.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 04:09:55 PST 2020


t.p.northover created this revision.
t.p.northover added a reviewer: dblaikie.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.
t.p.northover updated this revision to Diff 236551.
t.p.northover added a comment.

Relised I should test all modified places that print attrs.


While implementing inalloca types I discovered an issue with how we print attribute types (currently just byval). If the specified type references an anonymous Module-level one, the Attribute::getAsString function doesn't have the necessary context to figure out its number, so you'll see something like

  %0 = type opaque
  
  define void @foo(<{ %0* }>* byval(<{ %"type 0x7fe75580a800"* }>) %a) {
    ret void
  }

This patch puts the Attribute printing logic into AsmWriter for this case, where TypePrinting is available to do the right thing. I only applied it to function argument attributes because that's the only attribute that can have a type currently, but would be happy to be more aggressive.

It's also worth noting that the Verifier is still affected by this issue when printing its messages, but I decided that was probably OK since there should be other context to figure out the problem location.


https://reviews.llvm.org/D72323

Files:
  llvm/lib/IR/AsmWriter.cpp
  llvm/test/Assembler/byval-type-attr.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72323.236551.patch
Type: text/x-patch
Size: 3265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200107/f78c4ad3/attachment.bin>


More information about the llvm-commits mailing list