mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-22 21:31:19 +08:00
tree-optimization/107935 - fixup equivalence handling in PHI VN
The following makes sure to honor the backedge processing logic that forces VARYING there. PR tree-optimization/107935 * tree-ssa-sccvn.cc (visit_phi): Honor forced VARYING on backedges. * gcc.dg/torture/pr107935.c: New testcase.
This commit is contained in:
parent
2c08964027
commit
8629f212af
18
gcc/testsuite/gcc.dg/torture/pr107935.c
Normal file
18
gcc/testsuite/gcc.dg/torture/pr107935.c
Normal file
@ -0,0 +1,18 @@
|
||||
/* { dg-do compile } */
|
||||
|
||||
int *a, **b;
|
||||
int main() {
|
||||
int d = 0, *e = &d;
|
||||
L:
|
||||
*e = d;
|
||||
if (a) {
|
||||
int *g = e = *b;
|
||||
if (!e)
|
||||
__builtin_abort();
|
||||
if (**b)
|
||||
return 0;
|
||||
*g = 1;
|
||||
goto L;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -5840,7 +5840,12 @@ visit_phi (gimple *phi, bool *inserted, bool backedges_varying_p)
|
||||
continue;
|
||||
}
|
||||
/* There's also the possibility to use equivalences. */
|
||||
if (!FLOAT_TYPE_P (TREE_TYPE (def)))
|
||||
if (!FLOAT_TYPE_P (TREE_TYPE (def))
|
||||
/* But only do this if we didn't force any of sameval or
|
||||
val to VARYING because of backedge processing rules. */
|
||||
&& (TREE_CODE (sameval) != SSA_NAME
|
||||
|| SSA_VAL (sameval) == sameval)
|
||||
&& (TREE_CODE (def) != SSA_NAME || SSA_VAL (def) == def))
|
||||
{
|
||||
vn_nary_op_t vnresult;
|
||||
tree ops[2];
|
||||
|
Loading…
x
Reference in New Issue
Block a user