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

Feilong Jiang fjiang at openjdk.org
Fri Feb 3 05:06:58 UTC 2023


On Mon, 30 Jan 2023 13:57:59 GMT, Feilong Jiang <fjiang 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)

This pull request has now been integrated.

Changeset: 3ad6aef1
Author:    Feilong Jiang <fjiang at openjdk.org>
Committer: Fei Yang <fyang at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3ad6aef1496de914b70f00005465e4b22f248d4f
Stats:     37 lines in 1 file changed: 33 ins; 0 del; 4 mod

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

Reviewed-by: fyang, yadongwang

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

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


More information about the hotspot-compiler-dev mailing list