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

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #0)
> Revision r230164 [1] regressed:
> 
> FAIL: gcc.target/alpha/pr42269-1.c scan-assembler-not addl
> 
> on alpha-linux-gnu.
> 
> The difference starts in combine, where before the patch, we were able
> to combine insns:

Please scrap this, the correct analysis is below.

We start with following sequence:

(insn 19 18 20 2 (set (reg/v:DI 73 [ x ])
        (sign_extend:DI (subreg:SI (reg:DI 90) 0))) pr42269.c:9 2
{*extendsidi2_1}
     (expr_list:REG_DEAD (reg:DI 90)
        (nil)))
(insn 20 19 21 2 (set (reg:DI 91 [ x ])
        (zero_extend:DI (subreg/s/u:SI (reg/v:DI 73 [ x ]) 0))) pr42269.c:10 48
{zero_extendsidi2}
     (nil))

where before the referred patch, combine pass removes (insn 19), leaving only:

(insn 20 19 21 2 (set (reg:DI 91 [ x ])
        (zero_extend:DI (subreg/s/u:SI (reg/v:DI 73 [ x ]) 0))) pr42269.c:10 48
{zero_extendsidi2}
     (nil))
(note 21 20 22 2 NOTE_INSN_DELETED)

With the patched gcc, we still have:

(insn 19 18 20 2 (set (reg/v:DI 73 [ x ])
        (sign_extend:DI (subreg:SI (reg:DI 90) 0))) pr42269-fail.c:9 2
{*extendsidi2_1}
     (expr_list:REG_DEAD (reg:DI 90)
        (nil)))
(insn 20 19 21 2 (set (reg:DI 91 [ x ])
        (zero_extend:DI (subreg/s/u:SI (reg/v:DI 73 [ x ]) 0)))
pr42269-fail.c:10 48 {zero_extendsidi2}
     (nil))

Please note that (insn 19) above is redundant.

BTW: I wonder if combine pass is the correct place to perform this optimization
(please see PR 42269), we have ree pass that should remove redundant
extensions.

Reply via email to