Commit 61b70fcb by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/37662 (ice: tree check: expected ssa_name, have…

re PR tree-optimization/37662 (ice: tree check: expected ssa_name, have integer_cst in get_value_range, at tree-vrp.c:612)

	PR tree-optimization/37662
	PR tree-optimization/37663
	* tree-vrp.c (simplify_truth_ops_using_ranges): Don't call
	get_value_range with non-SSA_NAME.  Don't assert operands have been
	folded, instead just bail out.

	* gcc.c-torture/compile/pr37662.c: New test.
	* gcc.dg/pr37663.c: New test.

From-SVN: r140792
parent 00625fae
2008-09-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37662
PR tree-optimization/37663
* tree-vrp.c (simplify_truth_ops_using_ranges): Don't call
get_value_range with non-SSA_NAME. Don't assert operands have been
folded, instead just bail out.
2008-09-30 Andrew Pinski <andrew_pinski@playstation.sony.com> 2008-09-30 Andrew Pinski <andrew_pinski@playstation.sony.com>
* config/rs6000/rs6000.md (fnmadds combiner): Revert typo. * config/rs6000/rs6000.md (fnmadds combiner): Revert typo.
......
2008-09-30 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/37662
PR tree-optimization/37663
* gcc.c-torture/compile/pr37662.c: New test.
* gcc.dg/pr37663.c: New test.
2008-09-30 Janus Weil <janus@gcc.gnu.org> 2008-09-30 Janus Weil <janus@gcc.gnu.org>
PR fortran/36592 PR fortran/36592
......
/* PR tree-optimization/37662 */
extern int baz (void);
static int
foo (void)
{
return 1;
}
int
bar (void)
{
return foo () >= 1 ^ (baz () || 0) || 0;
}
/* PR tree-optimization/37663 */
/* { dg-do compile } */
/* { dg-options "-O2 -fwrapv" } */
extern void bar (void);
void
foo (int x)
{
x = 1 >= x;
int y = -1885403717;
x = x + (x != y * y);
if (x)
bar ();
}
...@@ -6304,9 +6304,12 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -6304,9 +6304,12 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
bool need_conversion; bool need_conversion;
op0 = gimple_assign_rhs1 (stmt); op0 = gimple_assign_rhs1 (stmt);
vr = get_value_range (op0);
if (TYPE_PRECISION (TREE_TYPE (op0)) != 1) if (TYPE_PRECISION (TREE_TYPE (op0)) != 1)
{ {
if (TREE_CODE (op0) != SSA_NAME)
return false;
vr = get_value_range (op0);
val = compare_range_with_value (GE_EXPR, vr, integer_zero_node, &sop); val = compare_range_with_value (GE_EXPR, vr, integer_zero_node, &sop);
if (!val || !integer_onep (val)) if (!val || !integer_onep (val))
return false; return false;
...@@ -6329,10 +6332,15 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt) ...@@ -6329,10 +6332,15 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
if (is_gimple_min_invariant (op1)) if (is_gimple_min_invariant (op1))
{ {
/* Exclude anything that should have been already folded. */ /* Exclude anything that should have been already folded. */
gcc_assert (rhs_code == EQ_EXPR || rhs_code == NE_EXPR if (rhs_code != EQ_EXPR
|| rhs_code == TRUTH_XOR_EXPR); && rhs_code != NE_EXPR
gcc_assert (integer_zerop (op1) || integer_onep (op1) && rhs_code != TRUTH_XOR_EXPR)
|| integer_all_onesp (op1)); return false;
if (!integer_zerop (op1)
&& !integer_onep (op1)
&& !integer_all_onesp (op1))
return false;
/* Limit the number of cases we have to consider. */ /* Limit the number of cases we have to consider. */
if (rhs_code == EQ_EXPR) if (rhs_code == EQ_EXPR)
......
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