RFR: 8333393: PhaseCFG::insert_anti_dependences can fail to raise LCAs and to add necessary anti-dependence edges [v13]
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Fri Feb 7 15:41:21 UTC 2025
On Fri, 7 Feb 2025 14:36:01 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:
> I have now investigated the PhiNode::Ideal restriction above. In summary, I have not found any simple change that resolves the present issue and does not introduce problems elsewhere.
Great investigation, Daniel! Thanks for taking the effort to investigate this issue thoroughly.
> I think that is very unfortunate that we might be relying on this Ideal transformation to be applied to ensure correctness later on.
I agree, there are probably many more examples of hidden dependencies on idealization for correctness in C2, but it would be good to avoid introducing more of these if possible.
@dlunde do we know at which point in the compilation chain the disjoint memory state invariant (that the above idealization restores) is broken? Would it be possible to do some analysis at that point to "simply" avoid producing the problematic memory subgraph in the first place?
> @chhagedorn Yes, I agree. If we want to enforce a memory graph invariant at the time of insert_anti_dependences, we should also assert that it holds as best we can.
I wonder if the core invariant we want to assert here is that two memory states with aliasing slices never overlap in time, after GCM and LCM are done. This could be checked by performing liveness analysis of the memory subgraph after GCM and LCM. This may sound expensive to compute but it could turn out to be acceptable in practice (for debug builds). The similarly expensive register-level liveness analysis in `PhaseOutput::perform_mach_node_analysis` takes no more than 1-2% of the entire C2 execution time, on average.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22852#discussion_r1946727644
More information about the hotspot-compiler-dev
mailing list