[PATCH] D97108: [Statepoint Lowering] Allow dead gc pointer from deopt section to be on register.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 02:16:49 PST 2021


skatkov added a comment.

In D97108#2579479 <https://reviews.llvm.org/D97108#2579479>, @reames wrote:

> I don't believe this is safe to land as is, at least without some careful framing and documenting of assumptions.
>
> The problem I see is that gc values are expected to have base pointers.  A gc pointer which appears in the deopt list, but not in the gc-value list doesn't have an associated base.  It might happen to be the base itself, but it also might not.  Now, it may be that in some particular use case, we know any deopt value must be a base, but we need a way to encode that fact if so.
>
> Taking a step back, how does this case arise?  If this is truly dead code, we might be better off lowering as a poison constant (or simply dropping it).

Hello Philip, thank you for your comment.
This corresponds to the case when some gc pointer is alive in deopt bundle while callee works and dead after return.
The typical case would be @llvm.experimental.deoptimize intrinsic. All gc values in deopt bundle are dead after the call.
RS4GC will generate the gc value mentioned in deopt bundle in gc bundle as well. Moreover it will generate a gc.relocate intruction for it.
However gc.relocate instruction will be removed by any DCE due to it has no uses (all code after deopt is dead) and trivially dead (as readonly).
After all gc.relocates are eliminated InstCombine will be able to remove this gc pointer from gc section.

As a result we come to the case when there is a deopt gc value which is not listed in gc section.
I could fix the instcombine to preserve the value in gc section but it will not help in terms of base/derived because the only place where base/derived
info is stored is gc.relocate.
If we really want to keep this information we should preserve gc.relocates for values listed in deopt bundle or find another place to track the property.


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

https://reviews.llvm.org/D97108



More information about the llvm-commits mailing list