diff options
author | Richard Biener <rguenther@suse.de> | 2020-07-28 09:45:52 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-07-29 13:30:14 +0200 |
commit | 2b2f3867c09c8977268b8ffbd646ac242188b335 (patch) | |
tree | 3a0e21225cc5f32893335cde1f5bb4f0356a63c4 /gcc/tree-ssa-loop-split.c | |
parent | 883eec6653b4dd89f7ed0cdad2b0b1010e045e12 (diff) | |
download | gcc-2b2f3867c09c8977268b8ffbd646ac242188b335.zip gcc-2b2f3867c09c8977268b8ffbd646ac242188b335.tar.gz gcc-2b2f3867c09c8977268b8ffbd646ac242188b335.tar.bz2 |
tree-optimization/96349 - avoid abnormal coalescing issues in loop split
This avoids splitting a loop when the entry value of a loop PHI is
involved with abnormal coalescing.
2020-07-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/96349
* tree-ssa-loop-split.c (stmt_semi_invariant_p_1): When the
condition runs into a loop PHI with an abnormal entry value give up.
* gcc.dg/torture/pr96349.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-loop-split.c')
-rw-r--r-- | gcc/tree-ssa-loop-split.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-split.c b/gcc/tree-ssa-loop-split.c index 7de95b5..1eb6be5 100644 --- a/gcc/tree-ssa-loop-split.c +++ b/gcc/tree-ssa-loop-split.c @@ -1145,6 +1145,16 @@ stmt_semi_invariant_p_1 (struct loop *loop, gimple *stmt, if (gimple_bb (stmt) == loop->header) { + /* If the entry value is subject to abnormal coalescing + avoid the transform since we're going to duplicate the + loop header and thus likely introduce overlapping life-ranges + between the PHI def and the entry on the path when the + first loop is skipped. */ + tree entry_def + = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop)); + if (TREE_CODE (entry_def) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (entry_def)) + return false; invar = loop_iter_phi_semi_invariant_p (loop, phi, skip_head); return invar; } |