From 111e0c9f4b0027d393f46fb8a5805fa2ac68283a Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Sat, 22 Jan 2005 16:48:23 +0000 Subject: [PATCH] re PR tree-optimization/19038 (tree-ssa causing loops to have more than one BB) 2005-01-20 Daniel Berlin Fix PR tree-optimization/19038 * tree-ssa-dom.c (cprop_operand): Don't replace loop invaeriant copies with loop variant ones. From-SVN: r94069 --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-dom.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 73db887aff1..1a9d9e6cbb7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-01-20 Daniel Berlin + + Fix PR tree-optimization/19038 + * tree-ssa-dom.c (cprop_operand): Don't replace loop invaeriant + copies with loop variant ones. + 2005-01-22 Kazu Hirata * cfganal.c, real.h, reorg.c, timevar.def, tree-ssa-ccp.c, diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 35847ec3f28..68147989e49 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -2819,6 +2819,14 @@ cprop_operand (tree stmt, use_operand_p op_p) extensions. */ else if (!may_propagate_copy (op, val)) return false; + + /* Do not propagate copies if the propagated value is at a deeper loop + depth than the propagatee. Otherwise, this may move loop variant + variables outside of their loops and prevent coalescing + opportunities. If the value was loop invariant, it will be hoisted + by LICM and exposed for copy propagation. */ + if (loop_depth_of_name (val) > loop_depth_of_name (op)) + return false; /* Dump details. */ if (dump_file && (dump_flags & TDF_DETAILS)) -- 2.30.2