public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112447] New: risc-v regression: FAIL: gcc.c-torture/execute/memset-3.c   -O3
@ 2023-11-08 20:11 vineetg at gcc dot gnu.org
  2023-11-08 22:05 ` [Bug target/112447] " juzhe.zhong at rivai dot ai
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: vineetg at gcc dot gnu.org @ 2023-11-08 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112447
           Summary: risc-v regression: FAIL:
                    gcc.c-torture/execute/memset-3.c   -O3
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: vineetg at gcc dot gnu.org
          Reporter: vineetg at gcc dot gnu.org
                CC: jeffreyalaw at gmail dot com, juzhe.zhong at rivai dot ai,
                    lehua.ding at rivai dot ai, rdapp at gcc dot gnu.org
  Target Milestone: ---

As reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111311#c8

we have following execute failures on trunk.

        === gcc: Unexpected fails for rv64gcv lp64d medlow ===
FAIL: gcc.c-torture/execute/memset-3.c   -O3 -g  execution test

The issue is an extraneous VSETVLI instruction (with wrong SEW) being generated
which creates wrong fill pattern for memset.

```
main:

[...]

.L36:  ; 2. loop start for @off 0 
        vse8.v          v1,0(t3)
        vse8.v          v1,0(t6)
        vse8.v          v1,0(s1)
        vse8.v          v3,0(a5)
...
        ; loop epilogue
        li      a7,15
        beq     a4,a7,.L171
        vsetvli zero,zero,e32,m2,ta,ma   <--- wrong
        j       .L36
```

vsetvli pass dumps:

```
Phase 3: Reduce global vsetvl infos. 

  Compute LCM insert and delete data:

      Expr[2]: VALID (insn 2847, bb 3)
        Demand fields: demand_sew_lmul demand_avl
        SEW=8, VLMUL=mf2, RATIO=16, MAX_SEW=64
        TAIL_POLICY=agnostic, MASK_POLICY=agnostic
        AVL=(const_int 8 [0x8])
        VL=(nil)

VSETVL infos after phase 3

  bb 3:
    probability: always (guessed)
    Header vsetvl info:VALID (insn 2847, bb 3) (deleted)  <---
      Demand fields: demand_sew_lmul demand_avl
      SEW=8, VLMUL=mf2, RATIO=16, MAX_SEW=64
      TAIL_POLICY=agnostic, MASK_POLICY=agnostic
      AVL=(const_int 8 [0x8])
      VL=(nil)
```

So it seems LCM is deleting the valid VSETVLI insn which later causes Phase 4
to insert a different/incorrect one.

I revert the following commit and the issue goes away. 

 2023-10-18 f0e28d8c1371 RISC-V: Fix failed hoist in LICM of vmv.v.x
instruction  

This at least tells us the cause of issue, next step is to fix the issue.

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-11-15 17:53 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 20:11 [Bug target/112447] New: risc-v regression: FAIL: gcc.c-torture/execute/memset-3.c -O3 vineetg at gcc dot gnu.org
2023-11-08 22:05 ` [Bug target/112447] " juzhe.zhong at rivai dot ai
2023-11-08 22:33 ` vineetg at gcc dot gnu.org
2023-11-08 22:34 ` vineetg at gcc dot gnu.org
2023-11-08 22:35 ` vineetg at gcc dot gnu.org
2023-11-08 22:40 ` juzhe.zhong at rivai dot ai
2023-11-08 22:46 ` vineetg at gcc dot gnu.org
2023-11-08 22:49 ` juzhe.zhong at rivai dot ai
2023-11-08 22:52 ` juzhe.zhong at rivai dot ai
2023-11-08 23:00 ` vineetg at gcc dot gnu.org
2023-11-08 23:01 ` juzhe.zhong at rivai dot ai
2023-11-14 20:02 ` vineetg at gcc dot gnu.org
2023-11-14 22:29 ` juzhe.zhong at rivai dot ai
2023-11-14 23:18 ` vineetg at gcc dot gnu.org
2023-11-14 23:23 ` juzhe.zhong at rivai dot ai
2023-11-14 23:34 ` vineetg at gcc dot gnu.org
2023-11-15  1:04 ` juzhe.zhong at rivai dot ai
2023-11-15  1:07 ` juzhe.zhong at rivai dot ai
2023-11-15  2:03 ` juzhe.zhong at rivai dot ai
2023-11-15  2:49 ` juzhe.zhong at rivai dot ai
2023-11-15  2:57 ` juzhe.zhong at rivai dot ai
2023-11-15 17:35 ` cvs-commit at gcc dot gnu.org
2023-11-15 17:53 ` vineetg at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).