RFR: 8344251: C2: remove blackholes with dead control input
Marc Chevalier
mchevalier at openjdk.org
Tue Apr 15 16:36:59 UTC 2025
On Tue, 15 Apr 2025 16:17:34 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> 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.
>
> Or you can di separate runs with different flags, including default.
I've added the `-Xcomp` flag because the dead `if` branch was compiled into an uncommon trap (reason = unstable_if), and I had no `BlackholeNode`. Looking at the code emitting the trap, it seems to come from some profiling information, but that the generation of this uncommon trap is explicitly disabled if `-Xcomp` is given. I am not entirely sure why, but `-XX:CompileThreshold=100` does the job to make the compilation of the dead `if` branch happen as well. But if I give no such flag, the test fails for lack of a `BlackholeNode` after parsing (also meaning that the test doesn't exercise the deletion of the `BlackholeNode`).
I'm currently testing further with `-XX:CompileThreshold=100` as suggested (it works on my laptop so far), but if you have a more canonical trick to inhibit the uncommon trap in the dead branch, I'd take happily!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24663#discussion_r2045039256
More information about the hotspot-compiler-dev
mailing list