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

Quan Anh Mai qamai at openjdk.org
Thu Jan 30 11:35:50 UTC 2025


On Tue, 28 Jan 2025 13:31:17 GMT, Daniel Lundén <dlunden at openjdk.org> wrote:

> Only if B1 dominates B2 and B2 dominates B3. It doesn't look like B1 dominates B2 in your illustration? Of course, it depends on if the ... part connects to B1.

Yes you are right, B1 should dominate B2 and B2 dominates B3.

> Assuming there is a path from B1 to B2 through the ... so that the Phi at B2 is indeed a search root, initial_mem and the Phi both represent the same memory state from which we want to load (this is what I mean by equivalence). The memory state cannot have been overwritten in ..., as otherwise initial_mem would not be at B1.

I see you are assuming that `initial_mem` can only be killed before it is merged in B2, which means that there should not be a case where:

    mem m1;
    mem m2;
    if (condition) {
    } else {
    }
    mem m = Phi(m1, m2);
    kill m1;

Theoretically, the kill here will also kill `m`, but I see you are assuming that there should not be a kill to `m1` after the merge to `m`.

Additionally, there can also be not:

    mem m1;
    mem m2;
    if (condition1) {
    } else {
    }
    mem m3 = Phi(m1, m2);
    if (condition2) {
    } else {
    }
    mem m4 = Phi(m1, m2);
    kill m3;

This kill will also kill `m4`, what is the invariant you think will hold that prevents this situation, we have seen in your first example that `107 Phi` and `119 Phi` contain the same memory slice and live at the same block, what if `119 Phi` is in an earlier block? Or is there anything that will prevent it from happening?

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

PR Comment: https://git.openjdk.org/jdk/pull/22852#issuecomment-2624243220


More information about the hotspot-compiler-dev mailing list