RFR: 8303627: compiler/loopopts/TestUnreachableInnerLoop.java failed with -XX:LoopMaxUnroll=4

SUN Guoyun duke at openjdk.org
Tue Mar 7 01:21:17 UTC 2023


On Mon, 6 Mar 2023 20:37:47 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> This test failed with VM_OPTIONS=-XX:LoopMaxUnroll=4 and CONF=fastdebug on X86_64, AArch64 LoongArch64 architecture.
>> 
>> <pre><code class="shell">
>> # A fatal error has been detected by the Java Runtime Environment:
>> #
>> # Internal Error (/home/sunguoyun/jdk-ls/src/hotspot/share/opto/block.cpp:1359), pid=31328, tid=31344
>> # assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
>> #
>> </code></pre>
>> This PR fix the issue, Please help review it.
>> 
>> Thanks.
>
> src/hotspot/share/opto/block.hpp line 195:
> 
>> 193:     if (dom_diff > 0)  return false;
>> 194:     for (; dom_diff < 0; dom_diff++)  that = that->_idom;
>> 195:     return (this == that) || (this != that && this->_dom_depth == that->_dom_depth);
> 
> I don't think this is correct. `this` should be reachable from `that` for this method return `true`. 
> Imaging you compare `B53->dominates(B61)` from your example.

Thanks @vnkozlov. The example I enumerate reflect the relationship between the related blocks when `TestUnreachableInnerLoop.java` fails. B53(this) cannot dominates B55(that), so trigger assertion error:
<pre><code class="shell">
#  Internal Error (/home/user/jdk-ls/src/hotspot/share/opto/block.cpp:1375), pid=17010, tid=17024
#  assert(n->is_Root() || n->is_Region() || n->is_Phi() || n->is_MachMerge() || def_block->dominates(block)) failed: uses must be dominated by definitions
</code></pre>
Indeed, as can be seen from this example, B53 and B61 only dominates itself, B52 dominates B54 and B55, so I'm not sure if this patch is the most correct solution, Do you have any good advice for me?

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

PR: https://git.openjdk.org/jdk/pull/12874


More information about the hotspot-compiler-dev mailing list