This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/52838] [x32] missed optimization for pointer return value


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52838

--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-04-04 21:41:02 UTC ---
> This looks like a combine problem:
> 
> (insn 8 6 9 2 (set (reg/f:SI 59 [ D.1705 ])
>         (subreg/s/u:SI (reg:DI 60) 0)) pr52838.c:6 64 {*movsi_internal}
>      (expr_list:REG_DEAD (reg:DI 60)
>         (nil)))
> 
> (insn 9 8 10 2 (set (reg/f:DI 62 [ D.1705 ])
>         (zero_extend:DI (reg/f:SI 59 [ D.1705 ]))) pr52838.c:6 112
> {*zero_extendsidi2_rex64}
>      (expr_list:REG_DEAD (reg/f:SI 59 [ D.1705 ])
>         (nil)))
> 
> This gets transformed by combine pass:
> 
> 
> Trying 8 -> 9:
> Successfully matched this instruction:
> (set (reg/f:DI 62 [ D.1705 ])
>     (reg:DI 60))
> deferring deletion of insn with uid = 8.
> modifying insn i3     9 r62:DI=r60:DI
>       REG_DEAD: r60:DI
> 
> into:
> 
> (note 8 6 9 2 NOTE_INSN_DELETED)
> 
> (insn 9 8 10 2 (set (reg/f:DI 62 [ D.1705 ])
>         (reg:DI 60)) pr52838.c:6 62 {*movdi_internal_rex64}
>      (expr_list:REG_DEAD (reg:DI 60)
>         (nil)))
> 
> But, but ... high 32 bits are not cleared anymore!

The existence of (subreg/s/u:SI (reg:DI 60) 0) means that (reg:DI 60) is known
to be a zero-extended 32-bit value, so the optimization is valid (and useful).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]