RFR: 8344251: C2: remove blackholes with dead control input
Aleksey Shipilev
shade at openjdk.org
Tue Apr 15 15:15:51 UTC 2025
On Tue, 15 Apr 2025 13:39:52 GMT, Marc Chevalier <mchevalier at openjdk.org> wrote:
> When a BlackholeNode's control input becomes dead, the node is not removed causing the crash
>
> assert(!in->is_CFG()) failed: CFG Node with no controlling input?
>
> In the case reported in the issue, after a round of peeling, a condition becomes constant, and the branch containing the blackhole becomes dead:
>
> <img src="https://github.com/user-attachments/assets/f8e5ec85-ddf5-4018-a01e-30ea90d9d74f" width="400">
> <img src="https://github.com/user-attachments/assets/626e40a1-be2f-4b1c-bc56-9760a26660f2" width="400">
>
> I simply use `Node::remove_dead_region(PhaseGVN*, bool)` to remove the blackhole, as many other node types do.
Right. I should have done the similar thing from the day 1 :)
src/hotspot/share/opto/cfgnode.cpp line 3114:
> 3112: Node* BlackholeNode::Ideal(PhaseGVN* phase, bool can_reshape) {
> 3113: return remove_dead_region(phase, can_reshape) ? this : nullptr;
> 3114: }
I think you need a newline after this definition.
test/hotspot/jtreg/compiler/blackhole/DeadBhElimination.java line 39:
> 37: public static void main(String[] args) {
> 38: TestFramework.runWithFlags(
> 39: "-Xcomp",
`-Xcomp` is likely too heavy-weight here. Other tests use `-XX:CompileThreshold=100`. I think that is enough for IR tests to compile the method.
-------------
PR Review: https://git.openjdk.org/jdk/pull/24663#pullrequestreview-2768806614
PR Review Comment: https://git.openjdk.org/jdk/pull/24663#discussion_r2044868535
PR Review Comment: https://git.openjdk.org/jdk/pull/24663#discussion_r2044876117
More information about the hotspot-compiler-dev
mailing list