tree-optimization/103204 - fix missed valueization in VN
The following fixes a missed valueization when simplifying a MEM[&...] combination during valueization. 2021-11-12 Richard Biener <rguenther@suse.de> PR tree-optimization/103204 * tree-ssa-sccvn.c (valueize_refs_1): Re-valueize the top operand after folding in an address. * gcc.dg/torture/pr103204.c: New testcase.
This commit is contained in:
parent
c60ded6f5e
commit
140346fa24
|
@ -0,0 +1,16 @@
|
|||
/* { dg-do compile } */
|
||||
|
||||
int a[1][1];
|
||||
int b, c;
|
||||
void d()
|
||||
{
|
||||
int e;
|
||||
int f[0];
|
||||
int *g;
|
||||
for (; e;)
|
||||
c = b;
|
||||
if (a[0][b] = (__UINTPTR_TYPE__)f != 3)
|
||||
g = &f[b];
|
||||
int h;
|
||||
*g = *g = *g = h;
|
||||
}
|
|
@ -1640,13 +1640,12 @@ static void
|
|||
valueize_refs_1 (vec<vn_reference_op_s> *orig, bool *valueized_anything,
|
||||
bool with_avail = false)
|
||||
{
|
||||
vn_reference_op_t vro;
|
||||
unsigned int i;
|
||||
|
||||
*valueized_anything = false;
|
||||
|
||||
FOR_EACH_VEC_ELT (*orig, i, vro)
|
||||
for (unsigned i = 0; i < orig->length (); ++i)
|
||||
{
|
||||
re_valueize:
|
||||
vn_reference_op_t vro = &(*orig)[i];
|
||||
if (vro->opcode == SSA_NAME
|
||||
|| (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME))
|
||||
{
|
||||
|
@ -1694,7 +1693,11 @@ valueize_refs_1 (vec<vn_reference_op_s> *orig, bool *valueized_anything,
|
|||
&& (*orig)[i - 1].opcode == MEM_REF)
|
||||
{
|
||||
if (vn_reference_maybe_forwprop_address (orig, &i))
|
||||
*valueized_anything = true;
|
||||
{
|
||||
*valueized_anything = true;
|
||||
/* Re-valueize the current operand. */
|
||||
goto re_valueize;
|
||||
}
|
||||
}
|
||||
/* If it transforms a non-constant ARRAY_REF into a constant
|
||||
one, adjust the constant offset. */
|
||||
|
|
Loading…
Reference in New Issue