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

--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> ---
The compiler first converts:

Created a new instruction chain #2
Building chain #2...
  Adding insn 12 to chain #2
Collected chain #2...
  insns: 12
Computing gain for chain #2...
  Instruction gain 4 with bb_freq 0.83 for    12: [`g21']=r103:TI
      REG_DEAD r103:TI
  Total gain: 5, weighted gain 3.32
Converting chain #2...
deferring rescan insn with uid = 12.

From:

(insn 12 11 15 4 (set (mem/c:TI (symbol_ref:DI ("g21") [flags 0x2]  <var_decl
0x7f07104091c8 g21>) [2 g21+0 S16 A64])
        (reg/v:TI 103 [ deadx22 ])) "pr126250.c":28:9 98 {*movti_internal}
     (expr_list:REG_DEAD (reg/v:TI 103 [ deadx22 ])
        (nil)))

to:

(insn 12 11 15 4 (set (mem/c:V1TI (symbol_ref:DI ("g21") [flags 0x2]  <var_decl
0x7f07104091c8 g21>) [2 g21+0 S16 A64])
        (reg/v:V1TI 103 [ deadx22 ])) "pr126250.c":28:9 2465 {movv1ti_internal}
     (expr_list:REG_DEAD (reg/v:V1TI 103 [ deadx22 ])
        (nil)))

Please note conversion of (reg 103).

The conversion also leaks to other instructions that use (reg 103):

(insn 21 20 22 5 (set (reg/v:TI 103 [ deadx22 ])
        (reg:TI 107)) "pr126250.c":34:15 98 {*movti_internal}
     (expr_list:REG_DEAD (reg:TI 107)
        (nil)))

and

(insn 25 24 26 6 (parallel [
            (set (reg:TI 108)
                (ashift:TI (reg/v:TI 103 [ deadx22 ])
                    (const_int 33 [0x21])))
            (clobber (reg:CC 17 flags))
        ]) "pr126250.c":34:15 1091 {ashlti3_doubleword}
     (expr_list:REG_DEAD (reg/v:TI 103 [ deadx22 ])
        (expr_list:REG_UNUSED (reg:CC 17 flags)
            (nil))))

that are not part of the conversion chain, creating partially converted invalid
instructions as shown in Comment#2.

Reply via email to