RFR: 8301313: RISC-V: C2: assert(false) failed: bad AD file due to missing match rule

Feilong Jiang fjiang at openjdk.org
Fri Feb 3 04:46:51 UTC 2023


On Tue, 31 Jan 2023 08:15:45 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> The RISC-V architecture does not support conditional move instructions or flags register for now. So we set `ConditionalMoveLimit` to 0 for this port to avoid the generation of the CMove node by C2. But turns out this could not avoid all CMove nodes generation: some CMove generations are not guarded by this parameter. Therefore, we still added several match rules in AD file for CMove nodes like `CMoveI_CmpI`/`CMoveL_CmpL` etc. to cover those scenarios:
>> 
>> https://github.com/openjdk/jdk/blob/ebb84ad70d3295d9a429904fcdacdb8ecd1bf434/src/hotspot/cpu/riscv/riscv.ad#L9994-L10096
>> 
>> In this case, we observed that CMoveL was generated in `PhaseIdealLoop::transform_long_range_checks`,  which is expected to match `cmoveL_cmpL` node:
>> https://github.com/openjdk/jdk/blob/ebb84ad70d3295d9a429904fcdacdb8ecd1bf434/src/hotspot/share/opto/loopnode.cpp#L1344-L1351
>> 
>> But `PhaseIdealLoop::optimize` after `PhaseIdealLoop::transform_long_range_checks` may replace CmpLNode with CmpINode in `CmpLNode::Ideal`:
>> https://github.com/openjdk/jdk/blob/ebb84ad70d3295d9a429904fcdacdb8ecd1bf434/src/hotspot/share/opto/subnode.cpp#L877-L886
>> 
>> There is no match rule in riscv.ad for CMoveL with CmpI, which result in the bad AD file crash.
>> 
>> With this fix, we should be able to cover all other CMove scenarios not guarded by `ConditionalMoveLimit`.
>> 
>> Testing:
>> 
>> - [x] jdk_foreign  with -XX:-TieredCompilation (linux-riscv64, fastdebug)
>> - [x] Tier1~3 on Unmatched board (linux-riscv64, release)
>
> Looks reasonable.

@RealFYang @yadongw -- Thanks!

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

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


More information about the hotspot-compiler-dev mailing list