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

--- Comment #14 from Drea Pinski <pinskia at gcc dot gnu.org> ---
Note adding `return 1234;` to the other return path works. Which tells me
something here.
I think what LRA is doing is correct. 

The clobber is NOT the issue, nor LRA.

Before cmpelim we have:
```
(insn 77 76 78 14 (set (reg:CCZ 17 flags)
        (compare:CCZ (reg:SI 5 di [orig:107 _12 ] [107])
            (reg:SI 1 dx [orig:126 _41 ] [126]))) "/app/example.cpp":19:10 15
{*cmpsi_1}
     (nil))
(jump_insn/s 78 77 79 14 (set (pc)
        (if_then_else (eq (reg:CCZ 17 flags)
                (const_int 0 [0]))
            (label_ref 83)
            (pc))) "/app/example.cpp":19:10 1482 {*jcc}
     (int_list:REG_BR_PROB 536870913 (nil))
 -> 83)
(note 79 78 80 15 [bb 15] NOTE_INSN_BASIC_BLOCK)
(insn 80 79 136 15 (set (reg:SI 0 ax [orig:133 <retval> ] [133])
        (reg/v:SI 40 r12 [orig:124 g ] [124])) "/app/example.cpp":20:16 discrim
1 100 {*movsi_internal}
     (nil))
(jump_insn 136 80 137 15 (set (pc)
        (label_ref 97)) "/app/example.cpp":20:16 discrim 1 1483 {jump}
     (nil)
 -> 97)
(barrier 137 136 83)
(code_label 83 137 84 16 2 (nil) [4 uses])
(note 84 83 85 16 [bb 16] NOTE_INSN_BASIC_BLOCK)
(insn 85 84 86 16 (clobber (reg/i:SI 0 ax)) "/app/example.cpp":23:1 -1
     (nil))

(insn 86 85 138 16 (clobber (reg:SI 0 ax [orig:133 <retval> ] [133]))
"/app/example.cpp":23:1 -1
     (nil))
(jump_insn 138 86 139 16 (set (pc)
        (label_ref 97)) "/app/example.cpp":23:1 1483 {jump}
     (nil)
 -> 97)
...
(barrier 142 141 97)
(code_label 97 142 100 19 1 (nil) [2 uses])
(note 100 97 99 19 [bb 19] NOTE_INSN_BASIC_BLOCK)
(insn 99 100 143 19 (use (reg/i:SI 0 ax)) "/app/example.cpp":23:1 -1
     (nil))
(note 143 99 0 NOTE_INSN_DELETED)
```

That looks correct, we only set ax on the branch for `_12 != _41`.

So this looks correct.
Being 2 clobbers in bb 16 against eax is ok; not a big issue.
One is redundant but should not change code that much.

Even until till csa it looks correct.

But jump2 looks wrong. It looks like it is not taking into account the clobber.

Reply via email to