https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118945

--- Comment #3 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
(In reply to JuzheZhong from comment #2)
> I have thought about this long time ago while I am working on supporting RVV
> on upstream GCC.
> 
> https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/37
> 
> I suggested we should have -mprefer-agnostic in RISC-V psabi.
> 
> When this option is allowed, the problem can be solved very easily:
> 
> 
> /* Get prefer tail policy.  */
> enum tail_policy
> get_prefer_tail_policy ()
> {
>   /* TODO: By default, we choose to use TAIL_ANY which allows
>      compiler pick up either agnostic or undisturbed. Maybe we
>      will have a compile option like -mprefer=agnostic to set
>      this value???.  */
>   return TAIL_ANY;
> }
> 
...
> in riscv-v.cc. I have already leave a TODO here.

Yeah I saw that TODO already and unfortunately just forcing the above function
to return TAIL_AGNOSTIC isn't enough to stop merging - for this test (whether
we use -mprefer-agnostic or a cpu tune is just an implementation detail and the
easy part)

It seems we need to change policy_compatible_p () which currently does the
following (in macro expanded code)

    if (prev_flags == policy_demand_type::ignore_policy 
        && next_flags == policy_demand_type::tail_policy_only) 
        return always_true (prev, next);

Since we have insn 70 with ignore_policy, it doesn't really check the m_ta for
both the infos.

Reply via email to