RFR: 8333393: PhaseCFG::insert_anti_dependences can fail to raise LCAs and to add necessary anti-dependence edges [v13]

Emanuel Peter epeter at openjdk.org
Wed Feb 5 16:21:12 UTC 2025


On Wed, 5 Feb 2025 16:02:59 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:

>> @dlunde I really don't want to block you here. I never understood the memory graph above the initial mem. Now that I see the example I'm getting new ideas 😅
>
> Thanks for the comment @eme64 @chhagedorn! Happy to iterate, never hesitate to provide comments. I do recall we discussed these MergeMem/Phi swap idealizations offline last week.
> 
> I think this looks very promising. Looking at the two rules you mention and applying them iteratively to our example
> 
> 7 Phi(3 MergeMem(1:A, 2:L), 5 MergeMem(1:A, 4:L))
> 
> I get
> 
> 7 Phi(3 MergeMem(1:A, 2:L), 5 MergeMem(1:A, 4:L)) into
>     MergeMem(Phi:A(1:A, 5 MergeMem(1:A, 4:L)),
>              Phi:L(2:L, 5 MergeMem(1:A, 4:L))) into
>     MergeMem(MergeMem(Phi:A(1:A, 1:A), Phi:L(1:A, 4:L)),
>              Phi:L(2:L, 5 MergeMem(1:A, 4:L))) into
>     MergeMem(MergeMem(Phi:A(1:A, 1:A), Phi:L(1:A, 4:L)),
>              Phi:L(2:L, 4:L)))
> 
> Then, after this, we should be able to merge the resulting `Phi:L(2:L, 4:L)` with 6 Phi (`initial_mem`). So, essentially, we have broken out the `L` part of `7 Phi` and realized it is the same as `6 Phi`. I guess this is what you are also saying?
> 
> For EXAMPLE 2:
> 
> 4 Phi(1:A, 3 MergeMem(1:A, 2:!L)) into
>     MergeMem(Phi(1:A, 1:A), Phi(1:A, 2:!L))
> 
> `Phi(1:A, 1:A)` is `1:A` so then we have a Phi-free path from `1 MachProj` to `5 membar_release` as well!
> 
> I'll have a look and see if I can figure out why we do not apply such idealizations here.

That sounds about right, yes! Thanks for persisting here. I'm really looking forward to what you find 😊

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22852#discussion_r1943254560


More information about the hotspot-compiler-dev mailing list