RFR: 8333393: PhaseCFG::insert_anti_dependences can fail to raise LCAs and to add necessary anti-dependence edges [v2]
Daniel Lundén
dlunden at openjdk.org
Wed Jan 8 11:01:49 UTC 2025
On Mon, 23 Dec 2024 11:06:05 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
>> Daniel Lundén has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Updates after comments
>
> src/hotspot/share/opto/gcm.cpp line 799:
>
>> 797: def_mem_state = use_mem_state; // It's not a possibly interfering store.
>> 798: if (use_mem_state == initial_mem)
>> 799: initial_mem = nullptr; // only process initial memory once
>
> Could you explain these changes?
Yes, of course. In the old version, we ensure that we only add the children of `initial_mem` once by checking if `use_mem_state == initial_mem` and then setting `initial_mem = nullptr` after the first occurrence. In the new version, we make use of the fact that it is equivalent to instead simply check if `def_mem_state == nullptr`. Entries on the worklist have `def_mem_state == nullptr` iff they are initial memory states that were added before the main worklist loop. We never add any entries to the worklist with `def_mem_state == nullptr` within the worklist loop itself, so we are guaranteed to process the children of entries with `def_mem_state == nullptr` only once (and we no longer need to set `initial_mem = nullptr`).
The simplification is especially important now that we can have multiple initial memory states. If we would do it the old way, we would instead need to check if `use_mem_state` is a member of the set of initial memory states, and also keep track of which initial memory states we have already visited.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22852#discussion_r1907002868
More information about the hotspot-compiler-dev
mailing list