RFR: 8351889: C2 crash: assertion failed: Base pointers must match (addp 344)

Roland Westrelin roland at openjdk.org
Tue Jun 3 15:03:58 UTC 2025


On Wed, 28 May 2025 08:34:27 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> My (somewhat limited) experience with delaying optimizations is that this can be quite brittle. You need to get the condition just right, otherwise it just happens again in some generalized case again - maybe you check for 1 level, and later it happens with 2 or more layers.

I don't disagree with that.

> I'm half-understanding the example you present. Can you show the IR nodes for your last step:
> 
> ```
> Store#195 -> AddP#516 -> AddP#544 -> CastPP#110
>                      -> CastPP#529
> ```
> 
> What exactly are the bases there? Your simplified drawings seem to show the flow of computation, but I cannot see what the bases are in it, right? You could enhance it, for example with `AddP#nnn(base:nnn)`. I think that would help me follow the example.

In the example above, the `CastPP`s are the bases. So the simplified drawings mostly only show how the `AddP`s are chained and the bases.

> Maybe some more full IR snippets could be helpful, maybe even IGV drawings. But that may be more work for you.

I rarely use the IGV so, yeah, that would be more work.

> I'm wondering if we could not have some other "cleanup" optimizations that fix up the bases. What are the assumptions about merging AddP's at a Phi? Is the base from before the Phi propagated to after the Phi? I'm missing some base understanding here to see through this ;)

There is a cleanup already. It's `ConstraintCastNode::dominating_cast()`. It's run during igvn (but in the case of this failure igvn can't prove domination) and loop opts (but in the case of this failure, we are one pass of loop opts short of cleaning things up). So we would need an extra run of loop of opts which seems to be quite a bit of overhead for this sort of issues. That's why I went with the igvn delay fix even though it's fragile.

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

PR Comment: https://git.openjdk.org/jdk/pull/25386#issuecomment-2935784074


More information about the hotspot-compiler-dev mailing list