[PATCH] D117890: [LangRef] Require elementtype attribute for gc.statepoint intrinsic

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 11:09:18 PST 2022


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

Ok, I got back to this today.  Short version, Nikita was right all along, and this patch is now LGTM.

Longer version...

I landed 57cf29a <https://reviews.llvm.org/rG57cf29ac1bc5d0a5e20a7262111c3d3463113c47> and 6e4f7c08 <https://reviews.llvm.org/rG6e4f7c08230be1e58dbbe4f6c672b3bf3bc9f357> which removed two uses of getActualReturnType.  These two are safe to drive from the type of the gc.result, since the code is unreachable if there isn't a gc.result present.

However, the remaining case can't be removed.  Specifically, we need to know the result type to know which phys regs are being clobbered by the call; that's a function of calling convention and call site signature (i.e. return type).

Given that, we have two options:

1. Require that the optimize preserve a gc.result if initially present.  This requires us not to recognize such calls as dead, and generally complicates the code to preserve optimizations we get for "free" today.
2. We find a way to express the type in the callsite again.

This patch implements (2), and does so in what appears to be a newly idiomatic way for opaque pointers.  (I'd missed that previously.)  As such, this looks like an utterly reasonable solution.

@nikic, are you going to follow up with the code changes to RS4GC and the IRBuilder interface?  Or would you like me to do so?


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

https://reviews.llvm.org/D117890



More information about the llvm-commits mailing list