Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > On 6/9/23 04:41, juzhe.zh...@rivai.ai wrote: >> @@ -4342,135 +4510,81 @@ pass_vsetvl::cleanup_insns (void) const >> } >> } >> >> +/* Return true if the SET result is not used by any instructions. */ >> +static bool >> +has_no_uses (basic_block cfg_bb, rtx_insn *rinsn, int regno) >> +{ >> + /* Handle the following case that can not be detected in RTL_SSA. */ >> + /* E.g. >> + li a5, 100 >> + vsetvli a6, a5... >> + ... >> + vadd (use a6) >> + >> + The use of "a6" is removed from "vadd" but the information is >> + not updated in RTL_SSA framework. We don't want to re-new >> + a new RTL_SSA which is expensive, instead, we use data-flow >> + analysis to check whether "a6" has no uses. */ > I'm a bit surprised there wasn't a reasonable way to update the RTL SSA > framework for this case. If we were to remove the entire vadd, then we > would have to update the uses of a6. If we have that capability, then I > would expect we could refactor the updating code so that we had an API > to remove an operand from an instruction. > > In fact, if we have a constant propagator in the RTL SSA framework, > wouldn't it have to have this capability?
RTL-SSA isn't supposed to be feature-complete in its current state. So yeah, if something is missing, it's better to add it to RTL-SSA rather than work around it in consumers. (Responding without fully understanding the context though, sorry.) Thanks, Richard