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

Vineet Gupta <vineetg at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Vineet Gupta <vineetg at gcc dot gnu.org> ---
Fixed with

commit 1c5e99ce8744c166d82cb96bbb2d58392b5fb8d7
Author: Edwin Lu <e...@rivosinc.com>
Date:   Tue Jun 10 13:26:42 2025 -0700

    RISC-V: Prevent speculative vsetvl insn scheduling

    The instruction scheduler appears to be speculatively hoisting vsetvl
    insns outside of their basic block without checking for data
    dependencies. This resulted in a situation where the following occurs

            vsetvli a5,a1,e32,m1,tu,ma
            vle32.v v2,0(a0)
            sub     a1,a1,a5 <-- a1 potentially set to 0
            sh2add  a0,a5,a0
            vfmacc.vv       v1,v2,v2
            vsetvli a5,a1,e32,m1,tu,ma <-- incompatible vinfo. update vl to 0
            beq     a1,zero,.L12 <-- check if avl is 0

    This patch would essentially delay the vsetvl update to after the branch
    to prevent unnecessarily updating the vinfo at the end of a basic block.

            PR/117974

Reply via email to