RFR: 8349523: Unused runtime calls to drem/frem should be removed
Marc Chevalier
duke at openjdk.org
Thu Feb 20 09:25:52 UTC 2025
On Wed, 19 Feb 2025 12:47:03 GMT, Marc Chevalier <duke at openjdk.org> wrote:
> Remove frem and drem macros nodes when the result is not used. These nodes have other outputs (like memory), which is not meaningful, but preventing them to be dropped so easily. This patch removes the useless frem/drem nodes, and by rewiring the inputs to the outputs.
>
> Thanks,
> Marc
Thanks for taking a look. I'm not sure what you mean, so I'll try to cover a couple of interpretations I could have.
1. Still do the rewiring, but return `Top` instead of `new ConINode(TypeInt::ZERO)` => I guess that doesn't change much. In any way, I need to return a fresh node, or `this` from ideal. So I can't return the `phase->C->top()` top node, or something like that, I'd have to create a new one, unlinked. I guess that would work, but it makes very little difference with my version.
2. Not doing the rewiring, at all, just return a `Top` node from `Ideal` => that would mean to replace the current frem/drem by a `Top`, which would propagate through the control output (at least, that's my current understanding), and just kill the flow (make top/unreachable) for everything under. That would terminate the execution there rather than just skipping computation.
3. If we are speaking about types, we could also return top from `Value()` => I think the same as above would happen.
But then again, I'm just getting used to this codebase, so I might be wrong. Or maybe I misunderstood and you meant something else!
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23694#issuecomment-2670911675
More information about the hotspot-compiler-dev
mailing list