RFR: 8351568: Improve source code documentation for PhaseCFG::insert_anti_dependences [v2]

Daniel Lundén dlunden at openjdk.org
Fri May 9 13:48:53 UTC 2025


On Fri, 9 May 2025 08:50:54 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> Technically, "outside of" is more appropriate here, because the stores that we bookkeep are not necessarily dominated by ("below") early. Since the search starts from `initial_mem`, which can be in a much earlier block than early, stores that we bookkeep can also be above early, or on completely distinct control-flow paths that do not even go through early. But, you are correct that only stores below early matter in the end.
>
> Thanks for the clarification. I think it would be good to add this note to the comment ("Note that stores in non_early_stores are not necessarily dominated by early. Since the search starts from ..." ).

Yes, I agree. I've now revised this comment:

  // Bookkeeping of possibly anti-dependent stores that we find outside of the
  // early block and that may need anti-dependence edges. Note that stores in
  // non_early_stores are not necessarily dominated by early. The search starts
  // from initial_mem, which can reside in a block that dominates early, and
  // therefore, stores we find may be in blocks that are on completely distinct
  // control-flow paths compared to early. However, in the end, only stores in
  // blocks dominated by early matters. The reason for bookkeeping not only
  // relevant stores is efficiency: we lazily record all possible
  // anti-dependent stores and add anti-dependence edges only to the relevant
  // ones at the very end of this method when we know the final updated LCA.

I wrote in my first comment that stores we find can be above (i.e., dominate) early, but this is not actually correct. It doesn't make sense that we overwrite the memory of a load before we even reach early. But, it is still very common that we find stores on completely distinct control-flow paths compared to early.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24926#discussion_r2081733516


More information about the hotspot-compiler-dev mailing list