summaryrefslogtreecommitdiffstats
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-20 04:08:01 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2005-12-20 04:08:01 +0000
commitcbbe917337558cc09654287feb8c1de6707f9f64 (patch)
tree8d2ebf3b6d782aec9f3bf036565cf93ba43dd849 /gcc/tree-cfgcleanup.c
parentb27beddde6c4355ee940f9cc5a67e1b37ad93bb8 (diff)
downloadppe42-gcc-cbbe917337558cc09654287feb8c1de6707f9f64.tar.gz
ppe42-gcc-cbbe917337558cc09654287feb8c1de6707f9f64.zip
* tree-ssa-dom.c (thread_across_edge): Do not use local_fold.
Strip away all type conversions after simplifying the condition. * tree-cfgcleanup.c (merge_phi_nodes): Allow merging in some cases the forwarder block dominates the destination. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108833 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 7e719c1dc33..6f8b1c05ad3 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -743,6 +743,39 @@ merge_phi_nodes (void)
nodes at BB. */
*current++ = bb;
}
+ else
+ {
+ tree phi;
+
+ /* BB dominates DEST. There may be many users of the PHI
+ nodes in BB. However, there is still a trivial case we
+ can handle. If the result of every PHI in BB is used
+ only by a PHI in DEST, then we can trivially merge the
+ PHI nodes from BB into DEST. */
+ for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
+ {
+ tree result = PHI_RESULT (phi);
+ int num_uses = num_imm_uses (result);
+ use_operand_p imm_use;
+ tree use_stmt;
+
+ /* If the PHI's result is never used, then we can just
+ ignore it. */
+ if (num_uses == 0)
+ continue;
+
+ /* Get the single use of the result of this PHI node. */
+ if (!single_imm_use (result, &imm_use, &use_stmt)
+ || TREE_CODE (use_stmt) != PHI_NODE
+ || bb_for_stmt (use_stmt) != dest)
+ break;
+ }
+
+ /* If the loop above iterated thorugh all the PHI nodes
+ in BB, then we can merge the PHIs from BB into DEST. */
+ if (!phi)
+ *current++ = bb;
+ }
}
/* Now let's drain WORKLIST. */
OpenPOWER on IntegriCloud