aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-predcom.c
diff options
context:
space:
mode:
authorZdenek Dvorak <dvorakz@suse.cz>2007-06-07 17:34:40 +0200
committerZdenek Dvorak <rakdver@gcc.gnu.org>2007-06-07 15:34:40 +0000
commit1b0cfaa6a890d6cea3ce6a98a707219cac2aedd6 (patch)
tree2586a430ab0f0ff3785d02bffe3655a97c934318 /gcc/tree-predcom.c
parent554a540059995075ef1f631dbbfc7ef975ede43f (diff)
downloadgcc-1b0cfaa6a890d6cea3ce6a98a707219cac2aedd6.zip
gcc-1b0cfaa6a890d6cea3ce6a98a707219cac2aedd6.tar.gz
gcc-1b0cfaa6a890d6cea3ce6a98a707219cac2aedd6.tar.bz2
re PR tree-optimization/32220 (internal compiler error: in eliminate_temp_copies, at tree-predcom.c:1937)
PR tree-optimization/32220 * tree-predcom.c (eliminate_temp_copies): Handle the case that loop phi node is reached before defining statement. * gfortran.dg/predcom-2.f: New testcase. From-SVN: r125531
Diffstat (limited to 'gcc/tree-predcom.c')
-rw-r--r--gcc/tree-predcom.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tree-predcom.c b/gcc/tree-predcom.c
index 5c90fb1..4e54713 100644
--- a/gcc/tree-predcom.c
+++ b/gcc/tree-predcom.c
@@ -1932,7 +1932,13 @@ eliminate_temp_copies (struct loop *loop, bitmap tmp_vars)
/* Base all the ssa names in the ud and du chain of NAME on VAR. */
stmt = SSA_NAME_DEF_STMT (use);
- while (TREE_CODE (stmt) == PHI_NODE)
+ while (TREE_CODE (stmt) == PHI_NODE
+ /* In case we could not unroll the loop enough to eliminate
+ all copies, we may reach the loop header before the defining
+ statement (in that case, some register copies will be present
+ in loop latch in the final code, corresponding to the newly
+ created looparound phi nodes). */
+ && bb_for_stmt (stmt) != loop->header)
{
gcc_assert (single_pred_p (bb_for_stmt (stmt)));
use = PHI_ARG_DEF (stmt, 0);