re PR rtl-optimization/69941 (bogus zero_extend transformation in postreload on aarch64)
PR rtl-optimization/69941 * postreload.c (reload_combine_recognize_pattern): Ensure all uses of the reg share its mode. PR rtl-optimization/69941 * gcc.dg/torture/pr69941.c: New test. From-SVN: r234001
This commit is contained in:
parent
29b9828fa4
commit
201d49e91f
4 changed files with 53 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2016-03-04 Bernd Schmidt <bschmidt@redhat.com>
|
||||
|
||||
PR rtl-optimization/69941
|
||||
* postreload.c (reload_combine_recognize_pattern): Ensure all uses of
|
||||
the reg share its mode.
|
||||
|
||||
2016-03-04 Jeff Law <law@redhat.com>
|
||||
|
||||
PR tree-optimization/69196
|
||||
|
|
|
@ -1057,7 +1057,6 @@ static bool
|
|||
reload_combine_recognize_pattern (rtx_insn *insn)
|
||||
{
|
||||
rtx set, reg, src;
|
||||
unsigned int regno;
|
||||
|
||||
set = single_set (insn);
|
||||
if (set == NULL_RTX)
|
||||
|
@ -1068,7 +1067,20 @@ reload_combine_recognize_pattern (rtx_insn *insn)
|
|||
if (!REG_P (reg) || REG_NREGS (reg) != 1)
|
||||
return false;
|
||||
|
||||
regno = REGNO (reg);
|
||||
unsigned int regno = REGNO (reg);
|
||||
machine_mode mode = GET_MODE (reg);
|
||||
|
||||
if (reg_state[regno].use_index < 0
|
||||
|| reg_state[regno].use_index >= RELOAD_COMBINE_MAX_USES)
|
||||
return false;
|
||||
|
||||
for (int i = reg_state[regno].use_index;
|
||||
i < RELOAD_COMBINE_MAX_USES; i++)
|
||||
{
|
||||
struct reg_use *use = reg_state[regno].reg_use + i;
|
||||
if (GET_MODE (*use->usep) != mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Look for (set (REGX) (CONST_INT))
|
||||
(set (REGX) (PLUS (REGX) (REGY)))
|
||||
|
@ -1090,8 +1102,6 @@ reload_combine_recognize_pattern (rtx_insn *insn)
|
|||
&& REG_P (XEXP (src, 1))
|
||||
&& rtx_equal_p (XEXP (src, 0), reg)
|
||||
&& !rtx_equal_p (XEXP (src, 1), reg)
|
||||
&& reg_state[regno].use_index >= 0
|
||||
&& reg_state[regno].use_index < RELOAD_COMBINE_MAX_USES
|
||||
&& last_label_ruid < reg_state[regno].use_ruid)
|
||||
{
|
||||
rtx base = XEXP (src, 1);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2016-03-04 Bernd Schmidt <bschmidt@redhat.com>
|
||||
|
||||
PR rtl-optimization/69941
|
||||
* gcc.dg/torture/pr69941.c: New test.
|
||||
|
||||
PR c/69824
|
||||
* gcc.dg/pr69824.c: New test.
|
||||
|
||||
|
|
30
gcc/testsuite/gcc.dg/torture/pr69941.c
Normal file
30
gcc/testsuite/gcc.dg/torture/pr69941.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* { dg-do run } */
|
||||
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
int e = 0;
|
||||
int f = 0;
|
||||
int *g = &e;
|
||||
|
||||
int fn1() { return b ? a : b; }
|
||||
|
||||
int main() {
|
||||
int h = fn1() <= 0x8000000000000000ULL; // h = 1;
|
||||
|
||||
int k = f; // k = 0;
|
||||
|
||||
long i = h ? k : k / h; // i = 0;
|
||||
|
||||
long l = (unsigned short)(i - 0x1800); // l = 0xe800
|
||||
|
||||
i = l ? l : c; // i = 0xe800;
|
||||
|
||||
*g = i; // *g = 0xe800; e = 0xe800;
|
||||
|
||||
unsigned char result = e >> 9; // result = 0x74;
|
||||
|
||||
if ((int)result != 0x74)
|
||||
__builtin_abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue