re PR tree-optimization/85822 (Maybe wrong code in VRP since r249150)
PR tree-optimization/85822 From-SVN: r260566
This commit is contained in:
parent
b72feab889
commit
ad4f3f5d4e
@ -1,3 +1,9 @@
|
||||
2018-05-23 Yury Gribov <tetra2005@gmail.com>
|
||||
|
||||
PR tree-optimization/85822
|
||||
* tree-vrp.c (is_masked_range_test): Fix handling of negative
|
||||
constants.
|
||||
|
||||
2018-05-23 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* tree-ssa-sccvn.c (vn_reference_lookup_3): Handle arbitrary
|
||||
|
@ -1,3 +1,8 @@
|
||||
2018-05-23 Yury Gribov <tetra2005@gmail.com>
|
||||
|
||||
PR tree-optimization/85822
|
||||
* c-c++-common/pr85822.c: New test.
|
||||
|
||||
2018-05-23 Richard Biener <rguenther@suse.de>
|
||||
|
||||
* gcc.dg/tree-ssa/ssa-fre-65.c: New testcase.
|
||||
|
27
gcc/testsuite/c-c++-common/pr85822.c
Normal file
27
gcc/testsuite/c-c++-common/pr85822.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* { dg-options "-O2" } */
|
||||
/* { dg-do run } */
|
||||
|
||||
static const long long int TagTypeNumber = 0xffff000000000000ll;
|
||||
|
||||
long long int x;
|
||||
|
||||
void foo(void)
|
||||
{
|
||||
x = TagTypeNumber + 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 0)
|
||||
foo ();
|
||||
|
||||
if ((x & TagTypeNumber) == TagTypeNumber)
|
||||
{
|
||||
unsigned y = (unsigned)x;
|
||||
__builtin_printf ("v: %u\n", y);
|
||||
if (y != 1)
|
||||
__builtin_abort ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -3844,10 +3844,10 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
|
||||
Such comparison can yield assertions like
|
||||
X >= XX...X00...0
|
||||
X <= XX...X11...1
|
||||
in case of COND_OP being NE_EXPR or
|
||||
in case of COND_OP being EQ_EXPR or
|
||||
X < XX...X00...0
|
||||
X > XX...X11...1
|
||||
in case of EQ_EXPR. */
|
||||
in case of NE_EXPR. */
|
||||
|
||||
static bool
|
||||
is_masked_range_test (tree name, tree valt, enum tree_code cond_code,
|
||||
@ -3867,6 +3867,10 @@ is_masked_range_test (tree name, tree valt, enum tree_code cond_code,
|
||||
|
||||
wi::tree_to_wide_ref mask = wi::to_wide (maskt);
|
||||
wide_int inv_mask = ~mask;
|
||||
/* Must have been removed by now so don't bother optimizing. */
|
||||
if (mask == 0 || inv_mask == 0)
|
||||
return false;
|
||||
|
||||
/* Assume VALT is INTEGER_CST. */
|
||||
wi::tree_to_wide_ref val = wi::to_wide (valt);
|
||||
|
||||
@ -3907,9 +3911,6 @@ is_masked_range_test (tree name, tree valt, enum tree_code cond_code,
|
||||
*low = wide_int_to_tree (type, val);
|
||||
*high = wide_int_to_tree (type, val | inv_mask);
|
||||
|
||||
if (wi::neg_p (val, TYPE_SIGN (type)))
|
||||
std::swap (*low, *high);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user