Commit 100f09a5 by Richard Biener Committed by Richard Biener

re PR tree-optimization/59139 (internal compiler error: in get_val_for, at…

re PR tree-optimization/59139 (internal compiler error: in get_val_for, at tree-ssa-loop-niter.c:2267)

2013-12-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/59139
	* tree-ssa-loop-niter.c (chain_of_csts_start): Properly match
	code in get_val_for.
	(get_val_for): Use gcc_checking_asserts.

	* gcc.dg/torture/pr59139.c: New testcase.

From-SVN: r205588
parent 75fcf287
2013-12-02 Richard Biener <rguenther@suse.de> 2013-12-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/59139
* tree-ssa-loop-niter.c (chain_of_csts_start): Properly match
code in get_val_for.
(get_val_for): Use gcc_checking_asserts.
2013-12-02 Richard Biener <rguenther@suse.de>
PR middle-end/59199
* tree-ssa-operands.c (opf_implicit): Remove. * tree-ssa-operands.c (opf_implicit): Remove.
(opf_address_taken): New flag. (opf_address_taken): New flag.
(get_expr_operands): Remove early out, pass down (get_expr_operands): Remove early out, pass down
2013-12-02 Richard Biener <rguenther@suse.de>
PR tree-optimization/59139
* gcc.dg/torture/pr59139.c: New testcase.
2013-12-02 Eric Botcazou <ebotcazou@adacore.com> 2013-12-02 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt30.adb: New test. * gnat.dg/opt30.adb: New test.
......
/* { dg-do compile } */
int a, b, c, d, e;
int fn1(p1, p2) { return p2 == 0 ? p1 : 1 % p2; }
void fn2()
{
c = 0;
for (;; c = (unsigned short)c)
{
b = 2;
for (; b; b = a)
{
e = fn1(2, c && 1);
d = c == 0 ? e : c;
if (d)
return;
}
}
}
...@@ -2167,7 +2167,8 @@ chain_of_csts_start (struct loop *loop, tree x) ...@@ -2167,7 +2167,8 @@ chain_of_csts_start (struct loop *loop, tree x)
return NULL; return NULL;
} }
if (gimple_code (stmt) != GIMPLE_ASSIGN) if (gimple_code (stmt) != GIMPLE_ASSIGN
|| gimple_assign_rhs_class (stmt) == GIMPLE_TERNARY_RHS)
return NULL; return NULL;
code = gimple_assign_rhs_code (stmt); code = gimple_assign_rhs_code (stmt);
...@@ -2235,7 +2236,7 @@ get_val_for (tree x, tree base) ...@@ -2235,7 +2236,7 @@ get_val_for (tree x, tree base)
{ {
gimple stmt; gimple stmt;
gcc_assert (is_gimple_min_invariant (base)); gcc_checking_assert (is_gimple_min_invariant (base));
if (!x) if (!x)
return base; return base;
...@@ -2244,7 +2245,7 @@ get_val_for (tree x, tree base) ...@@ -2244,7 +2245,7 @@ get_val_for (tree x, tree base)
if (gimple_code (stmt) == GIMPLE_PHI) if (gimple_code (stmt) == GIMPLE_PHI)
return base; return base;
gcc_assert (is_gimple_assign (stmt)); gcc_checking_assert (is_gimple_assign (stmt));
/* STMT must be either an assignment of a single SSA name or an /* STMT must be either an assignment of a single SSA name or an
expression involving an SSA name and a constant. Try to fold that expression involving an SSA name and a constant. Try to fold that
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment