mirror of git://gcc.gnu.org/git/gcc.git
re PR rtl-optimization/65321 (ICE on valid code at -O2 and -O3 with -g enabled in decompose, at rtl.h:2007)
PR rtl-optimization/65321 * cfgexpand.c (expand_debug_expr): Ensure shift amount isn't wider than shift mode. * var-tracking.c (use_narrower_mode): Likewise. * gcc.dg/pr65321.c: New test. From-SVN: r221298
This commit is contained in:
parent
caf2df93de
commit
26d83bccd1
|
|
@ -1,3 +1,10 @@
|
||||||
|
2015-03-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR rtl-optimization/65321
|
||||||
|
* cfgexpand.c (expand_debug_expr): Ensure shift amount isn't wider
|
||||||
|
than shift mode.
|
||||||
|
* var-tracking.c (use_narrower_mode): Likewise.
|
||||||
|
|
||||||
2015-03-10 Jan Hubicka <hubicka@ucw.cz>
|
2015-03-10 Jan Hubicka <hubicka@ucw.cz>
|
||||||
|
|
||||||
PR tree-optimization/65355
|
PR tree-optimization/65355
|
||||||
|
|
|
||||||
|
|
@ -3921,6 +3921,31 @@ expand_debug_expr (tree exp)
|
||||||
op1 = expand_debug_expr (TREE_OPERAND (exp, 1));
|
op1 = expand_debug_expr (TREE_OPERAND (exp, 1));
|
||||||
if (!op1)
|
if (!op1)
|
||||||
return NULL_RTX;
|
return NULL_RTX;
|
||||||
|
switch (TREE_CODE (exp))
|
||||||
|
{
|
||||||
|
case LSHIFT_EXPR:
|
||||||
|
case RSHIFT_EXPR:
|
||||||
|
case LROTATE_EXPR:
|
||||||
|
case RROTATE_EXPR:
|
||||||
|
case WIDEN_LSHIFT_EXPR:
|
||||||
|
/* Ensure second operand isn't wider than the first one. */
|
||||||
|
inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
|
||||||
|
if (SCALAR_INT_MODE_P (inner_mode))
|
||||||
|
{
|
||||||
|
machine_mode opmode = mode;
|
||||||
|
if (VECTOR_MODE_P (mode))
|
||||||
|
opmode = GET_MODE_INNER (mode);
|
||||||
|
if (SCALAR_INT_MODE_P (opmode)
|
||||||
|
&& (GET_MODE_PRECISION (opmode)
|
||||||
|
< GET_MODE_PRECISION (inner_mode)))
|
||||||
|
op1 = simplify_gen_subreg (opmode, op1, inner_mode,
|
||||||
|
subreg_lowpart_offset (opmode,
|
||||||
|
inner_mode));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
|
|
||||||
unary:
|
unary:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
2015-03-10 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR rtl-optimization/65321
|
||||||
|
* gcc.dg/pr65321.c: New test.
|
||||||
|
|
||||||
2015-03-10 Jan Hubicka <hubicka@ucw.cz>
|
2015-03-10 Jan Hubicka <hubicka@ucw.cz>
|
||||||
|
|
||||||
PR tree-optimization/65355
|
PR tree-optimization/65355
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* PR rtl-optimization/65321 */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-options "-O3 -g" } */
|
||||||
|
|
||||||
|
int a, b, c, d, e;
|
||||||
|
|
||||||
|
int
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
int h;
|
||||||
|
char i;
|
||||||
|
for (; c > 0;)
|
||||||
|
{
|
||||||
|
for (d = 0; d < 2; d++)
|
||||||
|
{
|
||||||
|
i = 1 << d;
|
||||||
|
if (i - a)
|
||||||
|
{
|
||||||
|
e = b = 0;
|
||||||
|
for (; c; c--)
|
||||||
|
d = 127;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
h = ~d;
|
||||||
|
if (h > c)
|
||||||
|
for (;;)
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
@ -1011,7 +1011,13 @@ use_narrower_mode (rtx x, machine_mode mode, machine_mode wmode)
|
||||||
return simplify_gen_binary (GET_CODE (x), mode, op0, op1);
|
return simplify_gen_binary (GET_CODE (x), mode, op0, op1);
|
||||||
case ASHIFT:
|
case ASHIFT:
|
||||||
op0 = use_narrower_mode (XEXP (x, 0), mode, wmode);
|
op0 = use_narrower_mode (XEXP (x, 0), mode, wmode);
|
||||||
return simplify_gen_binary (ASHIFT, mode, op0, XEXP (x, 1));
|
op1 = XEXP (x, 1);
|
||||||
|
/* Ensure shift amount is not wider than mode. */
|
||||||
|
if (GET_MODE (op1) == VOIDmode)
|
||||||
|
op1 = lowpart_subreg (mode, op1, wmode);
|
||||||
|
else if (GET_MODE_PRECISION (mode) < GET_MODE_PRECISION (GET_MODE (op1)))
|
||||||
|
op1 = lowpart_subreg (mode, op1, GET_MODE (op1));
|
||||||
|
return simplify_gen_binary (ASHIFT, mode, op0, op1);
|
||||||
default:
|
default:
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue