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

            Bug ID: 122215
           Summary: Nondeterminism in ICF on riscv32
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
                CC: amonakov at gcc dot gnu.org
  Target Milestone: ---

Created attachment 62524
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62524&action=edit
foo.c

This was reported in #gcc by cousteau in August and amonakov just reminded me
about it in the context of something else.

godbolt: https://gcc.godbolt.org/z/jE7791r1a (attached as foo.c).

The program has strange non-determinism from ICF where we sometimes have:
```
dual_reg_insn2:
        li      a4,0
        li      a5,0
        some_custom_insn a0,a0,a4
        ret
```
and other times (*) have:
```
dual_reg_insn2:
        addi    sp,sp,-16
        sw      s7,12(sp)
        sw      s8,8(sp)
        li      s7,0
        li      s8,0
        mv      a4,s7
        mv      a5,s8
        lw      s7,12(sp)
        lw      s8,8(sp)
        some_custom_insn a0,a0,a4
        addi    sp,sp,16
        jr      ra
```

Playing around on godbolt, I can't repro it with trunk, but that might just be
luck (or it really is just latent now).

(*) Just rebuilding with an added comment or trivial change to *FLAGS like -gN
will do it.

Reply via email to