aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-07-12 10:49:03 +0200
committerRichard Biener <rguenther@suse.de>2021-07-12 12:18:37 +0200
commit92343e0ba4d47f21ae20ffcb83d736bdbc15dae0 (patch)
tree24735458da32f09d12172504c90bfc032706b72e /gcc/tree-ssa-pre.c
parent123d0a597beb6d9865f808bf15b0d67f2a8fd5b2 (diff)
downloadgcc-92343e0ba4d47f21ae20ffcb83d736bdbc15dae0.zip
gcc-92343e0ba4d47f21ae20ffcb83d736bdbc15dae0.tar.gz
gcc-92343e0ba4d47f21ae20ffcb83d736bdbc15dae0.tar.bz2
tree-optimization/101394 - fix PRE full redundancy wrt abnormals
This avoids adding a copy from an abnormal picked up from PHI translation much like we'd avoid inserting the translated expression on pred edges. 2021-07-12 Richard Biener <rguenther@suse.de> PR tree-optimization/101394 * tree-ssa-pre.c (do_pre_regular_insertion): Avoid inserting copies from abnormals for a full redundancy. * gcc.dg/torture/pr101394.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index d86fe26..69141c2 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3412,7 +3412,11 @@ do_pre_regular_insertion (basic_block block, basic_block dom,
/* If all edges produce the same value and that value is
an invariant, then the PHI has the same value on all
edges. Note this. */
- else if (!cant_insert && all_same)
+ else if (!cant_insert
+ && all_same
+ && (edoubleprime->kind != NAME
+ || !SSA_NAME_OCCURS_IN_ABNORMAL_PHI
+ (PRE_EXPR_NAME (edoubleprime))))
{
gcc_assert (edoubleprime->kind == CONSTANT
|| edoubleprime->kind == NAME);