diff options
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr122079-1.c | 27 | ||||
-rw-r--r-- | gcc/tree-ssa-pre.cc | 8 |
2 files changed, 33 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr122079-1.c b/gcc/testsuite/gcc.dg/torture/pr122079-1.c new file mode 100644 index 0000000..0af01a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr122079-1.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fcode-hoisting" } */ + +int a, b, c; +void e(int *f) { + int d = 0; + if (f) + goto g; + goto h; +i: + d = 1 + f[0]; +j: + if (c) + goto h; +k: + if (b) + goto i; + if (a) + goto j; +g: + if (d + f[0]) + goto k; +h: + int l[] = {f[0]}; + if (a) + e(l); +} diff --git a/gcc/tree-ssa-pre.cc b/gcc/tree-ssa-pre.cc index 64ffaca..d08caab 100644 --- a/gcc/tree-ssa-pre.cc +++ b/gcc/tree-ssa-pre.cc @@ -2049,8 +2049,12 @@ prune_clobbered_mems (bitmap_set_t set, basic_block block, bool clean_traps) the bitmap_find_leader way to see if there's still an expression for it. For some ratio of to be removed values and number of values/expressions in the set this might be faster than rebuilding - the value-set. */ - if (any_removed) + the value-set. + Note when there's a MAX solution on one edge (clean_traps) do not + prune values as we need to consider the resulting expression set MAX + as well. This avoids a later growing ANTIC_IN value-set during + iteration, when the explicitly represented expression set grows. */ + if (any_removed && !clean_traps) { bitmap_clear (&set->values); FOR_EACH_EXPR_ID_IN_SET (set, i, bi) |