I tried refers_to_regno_p It can not work for us since it just return true or false whether the "rtx" has the regno.
In our situation, we remove "AVL" dependency when it appears once in the "rtx" otherwise, we don't eliminate "AVL" dependency. Would you mind giving me more suggestions? Thanks juzhe.zh...@rivai.ai From: Jeff Law Date: 2023-04-19 09:11 To: juzhe.zh...@rivai.ai; kito.cheng; Richard Biener CC: gcc-patches; palmer Subject: Re: [PATCH] RISC-V: Fix bug reported by PR109535 On 4/18/23 19:04, juzhe.zh...@rivai.ai wrote: > The bug issue reported by google/highway project: > (set(..........) > (reg:QI s0) > (reg:DI s0)) > > The "avl" operand rtx = (reg:DI s0) > count_occurrences return 1 however the actual regno occurrences should be 2. > In this case, the VSETVL PASS will eliminate the use of (reg:DI s0) then > file assertion in RTL_SSA. > Instead, we should not eliminate "s0" dependency. So these are not vector hard registers, but GPR hard registers. Meaning you have to worry about even more things. Consider case on rv32 when you ask to count (reg:QI s1) and there is a reference to (reg:DI s0). Prior to reload you also have to worry about SUBREGs. You probably need to be using refers_to_regno_p or something similar. jeff