RFR: 8302814: Delete unused CountLoopEnd instruct with CmpX [v3]
SUN Guoyun
duke at openjdk.org
Thu Feb 23 10:00:06 UTC 2023
On Thu, 23 Feb 2023 09:34:38 GMT, SUN Guoyun <duke at openjdk.org> wrote:
>> CountLoopEnd only for T_int, therefore the following instructs in riscv.ad are useless and should be deleted.
>>
>> CountedLoopEnd cmp (CmpL op1 op2)
>> CountedLoopEnd cmp (CmpU op1 op2)
>> CountedLoopEnd cmp (CmpP op1 op2)
>> CountedLoopEnd cmp (CmpN op1 op2)
>> CountedLoopEnd cmp (CmpF op1 op2)
>> CountedLoopEnd cmp (CmpD op1 op2)
>>
>> and CountedLoopEnd with CmpU on x86*.ad, aarch64.ad ar useless also.
>>
>> Please help review it.
>>
>> Thanks.
>
> SUN Guoyun has updated the pull request incrementally with one additional commit since the last revision:
>
> 8302814: Delete unused CountLoopEnd instruct with CmpX
For bytecodes if_icmpxx(used by java`s for loop)、ifeq/ifne/iflt/ifle/ifgt/ifge, if_icmpxx(used by java`s while loop), C2 compiler created CmpINode not CmpUNode, so I think that should doesn't exist CountedLoopNode with CmpUNode.
<pre><code class="cpp">
// src/hotspot/share/opto/parse2.cpp
2661 case Bytecodes::_ifeq: btest = BoolTest::eq; goto handle_ifxx;
2662 case Bytecodes::_ifne: btest = BoolTest::ne; goto handle_ifxx;
2663 case Bytecodes::_iflt: btest = BoolTest::lt; goto handle_ifxx;
2664 case Bytecodes::_ifle: btest = BoolTest::le; goto handle_ifxx;
2665 case Bytecodes::_ifgt: btest = BoolTest::gt; goto handle_ifxx;
2666 case Bytecodes::_ifge: btest = BoolTest::ge; goto handle_ifxx;
2667 handle_ifxx:
2668 // If this is a backwards branch in the bytecodes, add Safepoint
2669 maybe_add_safepoint(iter().get_dest());
2670 a = _gvn.intcon(0);
2671 b = pop();
2672 c = _gvn.transform( new CmpINode(b, a) );
2673 do_if(btest, c);
2674 break;
2675
2676 case Bytecodes::_if_icmpeq: btest = BoolTest::eq; goto handle_if_icmp;
2677 case Bytecodes::_if_icmpne: btest = BoolTest::ne; goto handle_if_icmp;
2678 case Bytecodes::_if_icmplt: btest = BoolTest::lt; goto handle_if_icmp;
2679 case Bytecodes::_if_icmple: btest = BoolTest::le; goto handle_if_icmp;
2680 case Bytecodes::_if_icmpgt: btest = BoolTest::gt; goto handle_if_icmp;
2681 case Bytecodes::_if_icmpge: btest = BoolTest::ge; goto handle_if_icmp;
2682 handle_if_icmp:
2683 // If this is a backwards branch in the bytecodes, add Safepoint
2684 maybe_add_safepoint(iter().get_dest());
2685 a = pop();
2686 b = pop();
2687 c = _gvn.transform( new CmpINode( b, a ) );
</code></pre>
-------------
PR: https://git.openjdk.org/jdk/pull/12648
More information about the hotspot-compiler-dev
mailing list