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
This commit is contained in:
parent
00625faea4
commit
61b70fcb8c
5 changed files with 58 additions and 5 deletions
|
@ -1,3 +1,11 @@
|
|||
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>
|
||||
|
||||
* config/rs6000/rs6000.md (fnmadds combiner): Revert typo.
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
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>
|
||||
|
||||
PR fortran/36592
|
||||
|
|
15
gcc/testsuite/gcc.c-torture/compile/pr37662.c
Normal file
15
gcc/testsuite/gcc.c-torture/compile/pr37662.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* PR tree-optimization/37662 */
|
||||
|
||||
extern int baz (void);
|
||||
|
||||
static int
|
||||
foo (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
bar (void)
|
||||
{
|
||||
return foo () >= 1 ^ (baz () || 0) || 0;
|
||||
}
|
15
gcc/testsuite/gcc.dg/pr37663.c
Normal file
15
gcc/testsuite/gcc.dg/pr37663.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* 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)
|
|||
bool need_conversion;
|
||||
|
||||
op0 = gimple_assign_rhs1 (stmt);
|
||||
vr = get_value_range (op0);
|
||||
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);
|
||||
if (!val || !integer_onep (val))
|
||||
return false;
|
||||
|
@ -6329,10 +6332,15 @@ simplify_truth_ops_using_ranges (gimple_stmt_iterator *gsi, gimple stmt)
|
|||
if (is_gimple_min_invariant (op1))
|
||||
{
|
||||
/* Exclude anything that should have been already folded. */
|
||||
gcc_assert (rhs_code == EQ_EXPR || rhs_code == NE_EXPR
|
||||
|| rhs_code == TRUTH_XOR_EXPR);
|
||||
gcc_assert (integer_zerop (op1) || integer_onep (op1)
|
||||
|| integer_all_onesp (op1));
|
||||
if (rhs_code != EQ_EXPR
|
||||
&& rhs_code != NE_EXPR
|
||||
&& rhs_code != TRUTH_XOR_EXPR)
|
||||
return false;
|
||||
|
||||
if (!integer_zerop (op1)
|
||||
&& !integer_onep (op1)
|
||||
&& !integer_all_onesp (op1))
|
||||
return false;
|
||||
|
||||
/* Limit the number of cases we have to consider. */
|
||||
if (rhs_code == EQ_EXPR)
|
||||
|
|
Loading…
Add table
Reference in a new issue