[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-02 Thread jakub at gcc dot gnu dot org


--- Comment #8 from jakub at gcc dot gnu dot org  2008-10-02 09:11 ---
*** Bug 37666 has been marked as a duplicate of this bug. ***


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||joel at gcc dot gnu dot org


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-02 Thread jakub at gcc dot gnu dot org


--- Comment #9 from jakub at gcc dot gnu dot org  2008-10-02 09:12 ---
*** Bug 35874 has been marked as a duplicate of this bug. ***


-- 

jakub at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||mstein dot lists at
   ||googlemail dot com


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-01 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2008-10-01 13:20 ---
Note that after tuples we always have a default label again, just the default
label isn't a default label.  I have a patch to fix that, sort of

Index: tree-vrp.c
===
*** tree-vrp.c  (revision 140810)
--- tree-vrp.c  (working copy)
*** execute_vrp (void)
*** 7149,7157 
--- 7149,7164 
  {
size_t j;
size_t n = TREE_VEC_LENGTH (su-vec);
+   tree label;
gimple_switch_set_num_labels (su-stmt, n);
for (j = 0; j  n; j++)
gimple_switch_set_label (su-stmt, j, TREE_VEC_ELT (su-vec, j));
+   /* As we may have replaced the default label with a regular one
+make sure to make it a real default label again.  This ensures
+optimal expansion.  */
+   label = gimple_switch_default_label (su-stmt);
+   CASE_LOW (label) = NULL_TREE;
+   CASE_HIGH (label) = NULL_TREE;
  }

if (VEC_length (edge, to_remove_edges)  0)


-- 


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-01 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2008-08-31 11:59:27 |2008-10-01 13:27:26
   date||


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-01 Thread rguenth at gcc dot gnu dot org


--- Comment #6 from rguenth at gcc dot gnu dot org  2008-10-01 15:09 ---
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-10-01 Thread rguenth at gcc dot gnu dot org


--- Comment #7 from rguenth at gcc dot gnu dot org  2008-10-01 15:11 ---
Subject: Bug 37285

Author: rguenth
Date: Wed Oct  1 15:09:26 2008
New Revision: 140814

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=140814
Log:
2008-10-01  Richard Guenther  [EMAIL PROTECTED]

PR middle-end/37285
* tree-vrp.c (execute_vrp): If we optimized away the default
case make sure to promote the label that got in place of it
to a default case label.

* gcc.c-torture/compile/pr37285.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.c-torture/compile/pr37285.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-vrp.c


-- 


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-09-09 Thread jsm28 at gcc dot gnu dot org


-- 

jsm28 at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P1


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-08-31 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2008-08-31 11:59 ---
The code in purge_dead_edges looks broken.

  /* If we don't see a jump insn, we don't know exactly why the block would
 have been broken at this point.  Look for a simple, non-fallthru edge,
 as these are only created by conditional branches.  If we find such an
 edge we know that there used to be a jump here and can then safely
 remove all non-fallthru edges.  */

but for switches we never have an edge with fallthru set (at least not on
the tree level, even before VRP runs).

And the splitting code now splits

;; basic block 3, loop depth 0, count 0
;; prev block 12, next block 4
;; pred:   12 [100.0%]  (fallthru)
;; succ:   5 [61.0%]  4 [39.0%] 
(note 17 51 18 3 [bb 3] NOTE_INSN_BASIC_BLOCK)
(insn 18 17 19 3 t.i:5 (set (reg:DI 3 3)
(reg/v:DI 120 [ l_symndx ])) -1 (nil))
(insn 19 18 20 3 t.i:5 (set (reg:DI 5 5)
(const_int 1 [0x1])) -1 (nil))
(call_insn/u 20 19 21 3 t.i:5 (parallel [
(set (reg:SI 3 3)
(call (mem:SI (symbol_ref:SI (__ucmpdi2) [flags 0x41]) [0 S4
A8])
(const_int 0 [0x0])))
(use (const_int 16 [0x10]))
(clobber (reg:SI 65 lr))
]) -1 (expr_list:REG_EH_REGION (const_int 0 [0x0])
(nil))
(expr_list:REG_DEP_TRUE (use (reg:DI 5 5))
(expr_list:REG_DEP_TRUE (use (reg:DI 3 3))
(nil
(insn 21 20 22 3 t.i:5 (set (reg:CCUNS 125)
(compare:CCUNS (reg:SI 3 3)
(const_int 1 [0x1]))) -1 (nil))
(jump_insn 22 21 23 3 t.i:5 (set (pc)
(if_then_else (leu (reg:CCUNS 125)
(const_int 0 [0x0]))
(label_ref 36)
(pc))) -1 (nil))
(insn 23 22 24 3 t.i:5 (set (reg:CC 126)
(compare:CC (subreg:SI (reg/v:DI 120 [ l_symndx ]) 0)
(const_int 0 [0x0]))) -1 (nil))
(jump_insn 24 23 25 3 t.i:5 (set (pc)
(if_then_else (ne (reg:CC 126)
(const_int 0 [0x0]))
(label_ref 29)
(pc))) -1 (nil))
(insn 25 24 26 3 t.i:5 (set (reg:CC 127)
(compare:CC (subreg:SI (reg/v:DI 120 [ l_symndx ]) 4)
(const_int 2 [0x2]))) -1 (nil))
(jump_insn 26 25 27 3 t.i:5 (set (pc)
(if_then_else (ne (reg:CC 127)
(const_int 0 [0x0]))
(label_ref 29)
(pc))) -1 (nil))
(jump_insn 27 26 28 3 t.i:5 (set (pc)
(label_ref 30)) -1 (nil))
(barrier 28 27 29)
(code_label 29 28 30 3 5  [2 uses])

at the jump target (code_label 29 28 30 3 5  [2 uses]) so we enter
purge_dead_edges with

;; basic block 16, loop depth 0, count 0
;; prev block 15, next block 4
;; pred:  
;; succ:   5 [61.0%]  4 [39.0%] 
(code_label 29 28 55 16 5  [2 uses])
(note 55 29 30 16 [bb 16] NOTE_INSN_BASIC_BLOCK)

so in the end it looks like we can remove the assert which leaves us with
(IMHO, my ppc fu is not too great) correct assembly generated.

Proposed patch:

Index: gcc/cfgrtl.c
===
--- gcc/cfgrtl.c(revision 139823)
+++ gcc/cfgrtl.c(working copy)
@@ -2324,10 +2324,11 @@ purge_dead_edges (basic_block bb)
ei_next (ei);
 }

-  gcc_assert (single_succ_p (bb));
-
-  single_succ_edge (bb)-probability = REG_BR_PROB_BASE;
-  single_succ_edge (bb)-count = bb-count;
+  if (single_succ_p (bb))
+{
+  single_succ_edge (bb)-probability = REG_BR_PROB_BASE;
+  single_succ_edge (bb)-count = bb-count;
+}

   if (dump_file)
 fprintf (dump_file, Purged non-fallthru edges from bb %i\n,


But this also shows a missed optimization as we now no longer merge
the case 0 ...1 range with the default case.  Before VRP we have

  switch (l_symndx_1(D)) default: L4, case 0 ... 1: L4, case 2: L3

so we could easily detect this.

Can you verify the generated assembly is correct with the proposed patch?

Thanks.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2008-08-31 11:59:27
   date||


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-08-30 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2008-08-30 14:10 ---
What is the ICE?  and with what options?  I get the same IL on i?86 but no
ICE.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-08-30 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2008-08-30 22:17 ---
../../src/bfd/xcofflink.c: In function '_bfd_xcoff_canonicalize_dynamic_reloc':
../../src/bfd/xcofflink.c:399: internal compiler error: in purge_dead_edges, at
cfgrtl.c:2327
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html for instructions.


-O1 -ftree-vrp is enough to reproduce the bug which shows the middle-end is not
ready for the IR changes that are done by VRP.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-08-30 Thread pinskia at gcc dot gnu dot org


--- Comment #3 from pinskia at gcc dot gnu dot org  2008-08-30 22:27 ---
One more thing I forgot to mention is that the ICE is during expand time.


-- 


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



[Bug middle-end/37285] [4.4 Regression] ICE while building binutils on ppc

2008-08-29 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|normal  |blocker
   Target Milestone|--- |4.4.0


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