[Bug rtl-optimization/69806] [6 Regression][SH] Combine doesn't see constant

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 20 08:54:00 GMT 2016


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

--- Comment #10 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #9)
> Please see PR69671 then, that CSE change is right, so you really need to
> find some solution at the backend side.  Look what fwprop* dumps show etc.

I've checked the before and after pass logs until combine.  The first change in
this case is in cse1.

Before r233133 it would propagate the shift count constant into the shift insn:

(insn 7 6 8 2 (set (reg:SI 169)
        (ashift:SI (reg:SI 175 [ x+4 ])
            (const_int 30 [0x1e]))) sh_tmp.cpp:34 161 {ashlsi3_d}
     (expr_list:REG_DEAD (reg:SI 175 [ x+4 ])
        (expr_list:REG_DEAD (reg:SI 170)
            (expr_list:REG_EQUAL (ashift:SI (reg:SI 175 [ x+4 ])
                    (const_int 30 [0x1e]))
                (nil)))))

Now it doesn't do it and the shift pattern remains as:

(insn 7 6 8 2 (set (reg:SI 169)
        (ashift:SI (reg:SI 175 [ x+4 ])
            (reg:SI 170))) sh_tmp.cpp:34 161 {ashlsi3_d}
     (expr_list:REG_DEAD (reg:SI 175 [ x+4 ])
        (expr_list:REG_DEAD (reg:SI 170)
            (expr_list:REG_EQUAL (ashift:SI (reg:SI 175 [ x+4 ])
                    (const_int 30 [0x1e]))
                (nil)))))


I could fix this in the backend in various ways.  I'll try out a couple of
things.


More information about the Gcc-bugs mailing list