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

Daniel Lundén dlunden at openjdk.org
Tue Jan 7 18:10:36 UTC 2025


On Mon, 23 Dec 2024 10:58:56 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:

>> Daniel Lundén has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Updates after comments
>
> src/hotspot/share/opto/gcm.cpp line 783:
> 
>> 781:     // Stop searching when we run out of dominators (b == nullptr) or when we
>> 782:     // step past the initial memory block (b == initial_mem_block->_idom).
>> 783:     while (b != nullptr && b != initial_mem_block->_idom) {
> 
> Can `b` be `nullptr` here? The highest up we can go in the dominator tree is the start block, whose immediate dominator is the root block, no?

Thanks, you are right. `b` is never `nullptr` and the second condition on its own is sufficient. I've replaced the first condition with an assert.

> src/hotspot/share/opto/gcm.cpp line 785:
> 
>> 783:     while (b != nullptr && b != initial_mem_block->_idom) {
>> 784:       if (b == initial_mem_block && !initial_mem->is_Phi()) {
>> 785:         break;
> 
> Could you add a brief code comment here explaining why the early break?

Sure, now added!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22852#discussion_r1905863109
PR Review Comment: https://git.openjdk.org/jdk/pull/22852#discussion_r1905863951


More information about the hotspot-compiler-dev mailing list