backport: re PR tree-optimization/59014 (wrong code at -Os and above on x86_64-linux-gnu)
Backported from mainline 2013-11-27 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/59014 * gcc.c-torture/execute/pr59014-2.c: New test. 2013-11-26 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/59014 * tree-vrp.c (register_edge_assert_for_1): Don't look through conversions from non-integral types or through narrowing conversions. * gcc.c-torture/execute/pr59014.c: New test. From-SVN: r210177
This commit is contained in:
parent
6f3ab47985
commit
a4639ccb03
|
@ -1,6 +1,13 @@
|
|||
2014-05-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
Backported from mainline
|
||||
2013-11-26 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/59014
|
||||
* tree-vrp.c (register_edge_assert_for_1): Don't look
|
||||
through conversions from non-integral types or through
|
||||
narrowing conversions.
|
||||
|
||||
2013-11-14 Jakub Jelinek <jakub@redhat.com>
|
||||
Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
2014-05-07 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
Backported from mainline
|
||||
2013-11-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/59014
|
||||
* gcc.c-torture/execute/pr59014-2.c: New test.
|
||||
|
||||
2013-11-26 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/59014
|
||||
* gcc.c-torture/execute/pr59014.c: New test.
|
||||
|
||||
2013-11-14 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/59101
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* PR tree-optimization/59014 */
|
||||
|
||||
__attribute__((noinline, noclone)) long long int
|
||||
foo (long long int x, long long int y)
|
||||
{
|
||||
if (((int) x | (int) y) != 0)
|
||||
return 6;
|
||||
return x + y;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
if (sizeof (long long) == sizeof (int))
|
||||
return 0;
|
||||
int shift_half = sizeof (int) * __CHAR_BIT__ / 2;
|
||||
long long int x = (3LL << shift_half) << shift_half;
|
||||
long long int y = (5LL << shift_half) << shift_half;
|
||||
long long int z = foo (x, y);
|
||||
if (z != ((8LL << shift_half) << shift_half))
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/* PR tree-optimization/59014 */
|
||||
|
||||
int a = 2, b, c, d;
|
||||
|
||||
int
|
||||
foo ()
|
||||
{
|
||||
for (;; c++)
|
||||
if ((b > 0) | (a & 1))
|
||||
;
|
||||
else
|
||||
{
|
||||
d = a;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
foo ();
|
||||
if (d != 2)
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
|
@ -4536,9 +4536,13 @@ register_edge_assert_for_1 (tree op, enum tree_code code,
|
|||
}
|
||||
else if (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (op_def)))
|
||||
{
|
||||
/* Recurse through the type conversion. */
|
||||
retval |= register_edge_assert_for_1 (gimple_assign_rhs1 (op_def),
|
||||
code, e, bsi);
|
||||
/* Recurse through the type conversion, unless it is a narrowing
|
||||
conversion or conversion from non-integral type. */
|
||||
tree rhs = gimple_assign_rhs1 (op_def);
|
||||
if (INTEGRAL_TYPE_P (TREE_TYPE (rhs))
|
||||
&& (TYPE_PRECISION (TREE_TYPE (rhs))
|
||||
<= TYPE_PRECISION (TREE_TYPE (op))))
|
||||
retval |= register_edge_assert_for_1 (rhs, code, e, bsi);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
|
Loading…
Reference in New Issue