[PATCH] D124631: [TwoAddressInstructionPass] Special processing of STATEPOINT instruction.

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 06:01:36 PDT 2022


dantrushin added a comment.

In D124631#3481046 <https://reviews.llvm.org/D124631#3481046>, @MatzeB wrote:

>> Its important property is that at SSA level
>
> I assume what you are explaining here is that at a `STATEPOINT` a moving garbage collector can potentially move objects around and needs to update pointer values. That likely needs additional correctness properties on top of ending the lifetimes (like requiring that any life GC controlled pointer must be an argument to the STATEPOINT). Anyway as far as I understand it this discussion seems irrelevant to this patch.
>
>> This means that when transforming it into two-address form, no extra COPY instruction is necessary.
>
> I thought you only get a COPY when a value actually is alive across the instruction, which would be an invalid input anyway as far as I understand things. So I still don't see what we change here.

No. TwoaddressPass always inserts COPY (unless it can untie operands by commuting or converting to 3-address form).
And all my above explanations were in fact clumsy attempt to explain that tied-use operand is killed by statepoint, so tied def/use pair can be assigned to the same register without inserting COPY.
I think that this is true in general, but for 'regular' instructions nobody cares, as they usually have at most single tied def/use pair. STATEPOINTs can have tens of such pairs, so avoiding redundant COPY insertions becomes really important for them.
Also please note that 'killed' property for tied operands is not easy. Different parts of LLVM have different opinions whether tied-use operand may be marked as 'Kill' (even if it is not live across instruction).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124631



More information about the llvm-commits mailing list