re PR tree-optimization/70986 (ICE on valid code at -O3 on x86_64-linux-gnu in combine_blocks, at tree-if-conv.c:2219)

2016-05-12  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70986
	* cfganal.c: Include cfgloop.h.
	(dfs_find_deadend): Prefer to take edges exiting loops.

	* gcc.dg/torture/pr70986-1.c: New testcase.
	* gcc.dg/torture/pr70986-2.c: Likewise.
	* gcc.dg/torture/pr70986-3.c: Likewise.

From-SVN: r236158
This commit is contained in:
Richard Biener 2016-05-12 07:18:58 +00:00 committed by Richard Biener
parent b5aa474d1e
commit 44ab146a72
6 changed files with 89 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/70986
* cfganal.c: Include cfgloop.h.
(dfs_find_deadend): Prefer to take edges exiting loops.
2016-05-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* gcc.target/powerpc/pr70963.c: Require at least power8 at both

View File

@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfghooks.h"
#include "timevar.h"
#include "cfganal.h"
#include "cfgloop.h"
/* Store the data structures necessary for depth-first search. */
struct depth_first_search_ds {
@ -747,7 +748,21 @@ dfs_find_deadend (basic_block bb)
return bb;
}
bb = EDGE_SUCC (bb, 0)->dest;
/* If we are in an analyzed cycle make sure to try exiting it.
Note this is a heuristic only and expected to work when loop
fixup is needed as well. */
if (! bb->loop_father
|| ! loop_outer (bb->loop_father))
bb = EDGE_SUCC (bb, 0)->dest;
else
{
edge_iterator ei;
edge e;
FOR_EACH_EDGE (e, ei, bb->succs)
if (loop_exit_edge_p (bb->loop_father, e))
break;
bb = e ? e->dest : EDGE_SUCC (bb, 0)->dest;
}
}
gcc_unreachable ();

View File

@ -1,3 +1,10 @@
2016-05-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/70986
* gcc.dg/torture/pr70986-1.c: New testcase.
* gcc.dg/torture/pr70986-2.c: Likewise.
* gcc.dg/torture/pr70986-3.c: Likewise.
2016-05-11 Mikhail Maltsev <maltsevm@gmail.com>
PR c/43651

View File

@ -0,0 +1,22 @@
/* { dg-do compile } */
int a, g;
char b, c;
short d, e, f;
char
fn1 ()
{
return a ? a : 1;
}
void
fn2 ()
{
char h;
for (; d;)
for (; e; e++)
c = (fn1 () && h) & !(f |= 9 ^ (b > (g = c)));
for (;;)
;
}

View File

@ -0,0 +1,20 @@
/* { dg-do compile } */
int gi, dg;
void
fe (void)
{
int ka = gi;
for (;;)
{
if (ka != 0)
{
if (dg != 0)
gi = 0;
++ka;
}
++dg;
}
}

View File

@ -0,0 +1,18 @@
/* { dg-do compile } */
int a, b;
int
fn1 (int p1)
{
return p1 < 0 ? p1 : a;
}
void
fn2 ()
{
lbl_100:
b = 1;
for (; b != 21; b = fn1 (b))
;
goto lbl_100;
}