Plan to create unique types for inputs of allocation merges
Cesar Soares Lucas
Divino.Cesar at microsoft.com
Mon Feb 6 19:56:08 UTC 2023
Hello there!
Can I please get some feedback on the following plan?
---
Plan to patch the split_unique_types method to make it able to create
unique types for inputs participating in NoEscape merges. The motivation for
doing this is because it will make possible to remove the allocation merge
(after making other changes) and scalar replace some of the merge's input. I
will be concurrently working on a different set of changes to eliminate the
allocation merges.
My idea is to approach this in three parts. The parts are separated by the type
of node that uses the allocation merge.
1) Merges that have only SafePoint (and subclasses) nodes as users. This will
let me handle merges used as debug information in SafePoints. There are not many
merges that are only used by SafePoints but SafePointNode is the most common
user of merges (the merge is used by a SafePointNode and some other type
of node).
2) Also handle merges that have field loads as users. This will let me later on
split-thru-phi the loads and after some other changes remove the merge.
With (1) and (2) in place many (maybe most) merge usage patterns can be
simplified.
3) Also handle merges that have Store as users. This is by far the most
complicated case. It might not be possible to handle this kind of merge in
general, but we can make some cases work. My current idea for handling this
scenario is to clone the Store, make each one use a different input from the
merge and have a different unique type. This will require adding a "selector
phi" to output which input of the merge should be used and IfNode's to control
the execution of the cloned Store's. I understand we'll need to limit the number
of bases and stores that we can handle.
As an illustration of the 3rd scenario above, this code:
p = phi(x, o1, o2);
p.x = 10; // no instance_id
would become:
p1 = phi(x, o1, NULL);
p2 = phi(x, NULL, o2);
sl = phi(x, 0, 1); // selector Phi
if (sl == 0)
p1.x = 10; // instance_id "1"
else
p2.x = 10; // instance_id "2"
Best regards,
Cesar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-compiler-dev/attachments/20230206/e1cfaaf2/attachment-0001.htm>
More information about the hotspot-compiler-dev
mailing list