[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-23 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #7 from Jeffrey A. Law  ---
*** Bug 68328 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-23 Thread law at redhat dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #8 from Jeffrey A. Law  ---
*** Bug 68185 has been marked as a duplicate of this bug. ***

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-16 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #6 from ktkachov at gcc dot gnu.org ---
Proposed patch at:
https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01953.html

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-16 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #5 from ktkachov at gcc dot gnu.org ---
The different if-conversion behaviour enabled a new cse opportunity
which then produced the RTL that triggered the bad ree behaviour.
The relevant RTL insns before the ree pass look like:

Basic Block A:
(set (reg:HI 0 ax)
 (mem:HI (symbol_ref:DI ("f"
...
(set (reg:SI 3 bx)
 (if_then_else:SI (eq (reg:CCZ 17 flags)
(const_int 0))
(reg:SI 0 ax)
(reg:SI 3 bx)))

(set (reg:SI 4 si)
 (sign_extend:SI (reg:HI 3 bx)))
...
Basic block B (dominated by basic block A):
(set (reg:SI 4 si)
 (sign_extend:SI (reg:QI 0 ax))) /* ax contains symbol "f".  */


ree changes that into the broken:
Basic block A:
(set (reg:SI 4 si)
 (sign_extend:SI (mem:HI (symbol_ref:DI ("f")

(set (reg:SI 3 bx)
 (reg:SI 4 si))

...
(set (reg:SI 3 bx)
 (if_then_else:SI (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
(reg:SI 0 ax)
(reg:SI 3 bx)))
...
Basic block B:
(set (reg:SI 4 si)
 (sign_extend:SI (reg:QI 0 ax))) /* Insn unchanged by ree, but ax now
undefined.  */

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-13 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ktkachov at gcc dot 
gnu.org
  Known to fail||6.0

--- Comment #4 from ktkachov at gcc dot gnu.org ---
In the end, I think the "ree" pass is at fault here.
I'm testing a patch.

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #3 from ktkachov at gcc dot gnu.org ---
Created attachment 36641
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36641=edit
cse2 dump containing the 'bad' RTL

attaching the cse2 dump.

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

Richard Biener  changed:

   What|Removed |Added

   Keywords||wrong-code
   Target Milestone|--- |6.0
Summary|wrong code at -O2 and -O3   |[6 Regression] wrong code
   |on x86_64-linux-gnu |at -O2 and -O3 on
   ||x86_64-linux-gnu

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-03 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

--- Comment #2 from ktkachov at gcc dot gnu.org ---
Created attachment 36640
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36640=edit
cprop dump before the suspected bad transformation

Confirmed the failure.
However I think the cited revision (RTL if-conversion change) exposes another
bug.

I think cse goes wrong and ends up CSEing a memory load from a symbol_ref to
'f':
(insn 67 66 68 13 (set (reg:HI 108 [ f ])
(mem/c:HI (symbol_ref:DI ("f") [flags 0x2]  ) [2 f+0 S2 A16])) fail.c:28 88 {*movhi_internal}
 (nil))
(insn 68 67 69 13 (set (reg:SI 109 [ f ])
(sign_extend:SI (subreg:QI (reg:HI 108 [ f ]) 0))) fail.c:28 146
{extendqisi2}
 (expr_list:REG_DEAD (reg:HI 108 [ f ])
(nil)))

in basic block 13 gets transformed to:
(insn 68 66 69 13 (set (reg:SI 109 [ f ])
(sign_extend:SI (subreg:QI (reg:HI 112 [ f ]) 0))) fail.c:28 146
{extendqisi2}
 (expr_list:REG_DEAD (reg:HI 108 [ f ])
(nil)))

because (symbol_ref:DI ("f") gets loaded into reg 112 in another basic block
(bb 8).
This seems bogus to me.
Indeed, adding -fno-rerun-cse-after-loop (the flag controlling cse2) to the
flags makes the testcase pass

[Bug rtl-optimization/68194] [6 Regression] wrong code at -O2 and -O3 on x86_64-linux-gnu

2015-11-03 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68194

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-11-03
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Started with r228194.