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 tree-optimization/59747] [4.9 Regression] wrong code at -Os and above on x86_64-linux-gnu in 64-bit mode


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

--- Comment #7 from Jeffrey A. Law <law at redhat dot com> ---
In response to your question in c#6, if you use the most obvious form:

ORIG:
(set (reg1) (expression))
(set (reg2) (any_extend (reg1))
TRANSFORMED:
(set (reg1) (any_extend (expression)))
(set (reg2) (reg1))

Then the copy isn't typically propagated away and we don't actually improve the
code. If we look at the original testcase, the obvious form would look
something like this:

(insn 9 5 24 2 (set (reg:DI 0 ax)
        (sign_extend:DI (mem:HI (plus:DI (mult:DI (reg/v:DI 1 dx [orig:91 rdx ]
[91])
                        (const_int 2 [0x2]))
                    (symbol_ref:DI ("code")  <var_decl 0x7f48935f01c8 code>))
[2 code S2 A16]))) l.c:13 144 {extendhidi2}
     (nil))
(insn 24 9 12 2 (set (reg/v:DI 1 dx [orig:84 rdx ] [84])
        (reg:DI 0 ax)) l.c:13 -1
     (nil))
(note 12 24 13 2 NOTE_INSN_DELETED)
(insn 13 12 14 2 (set (reg:DI 0 ax [orig:95 D.1797 ] [95])
        (zero_extend:DI (reg:QI 0 ax [orig:83 D.1796 ] [83]))) l.c:16 133
{zero_extendqidi2}
     (nil))
(insn 14 13 15 2 (parallel [
            (set (reg:DI 1 dx [orig:96 rdx ] [96])
                (ashiftrt:DI (reg/v:DI 1 dx [orig:84 rdx ] [84])
                    (const_int 8 [0x8])))
            (clobber (reg:CC 17 flags))
        ]) l.c:15 563 {*ashrdi3_1}
     (nil))

To get any improvement we must be able to propagate insn24 away and that's
nontrivial to do in that form.


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