aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-10-19 14:00:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-10-19 14:00:28 +0000
commite6503e0a45efcea6a0cdc5aeab165e084b0eb624 (patch)
tree075dea0c963d70dcf98b41407036d2fb506b1b92 /gcc/tree-ssa-loop-im.c
parent4534c2032ba23be0a1f6b74ea2e23bc94df0cb81 (diff)
downloadgcc-e6503e0a45efcea6a0cdc5aeab165e084b0eb624.zip
gcc-e6503e0a45efcea6a0cdc5aeab165e084b0eb624.tar.gz
gcc-e6503e0a45efcea6a0cdc5aeab165e084b0eb624.tar.bz2
re PR tree-optimization/67975 (Failure to optimise equality between two call sequences)
2015-10-19 Richard Biener <rguenther@suse.de> PR tree-optimization/67975 * tree-cfg.h (extract_true_false_controlled_edges): Declare. * tree-cfg.c (extract_true_false_controlled_edges): Split out core worker from ... * tree-ssa-loop-im.c (extract_true_false_args_from_phi): ... here. * tree-ssa-sccvn.c (vn_phi_compute_hash): Hash number of args instead of block number for PHIs with two or one args. (vn_phi_eq): Compare edge predicates of PHIs that are in different blocks. * gcc.dg/tree-ssa/ssa-fre-50.c: New testcase. From-SVN: r228971
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c51
1 files changed, 5 insertions, 46 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 603e6d4..0598c18 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -619,56 +619,15 @@ static bool
extract_true_false_args_from_phi (basic_block dom, gphi *phi,
tree *true_arg_p, tree *false_arg_p)
{
- basic_block bb = gimple_bb (phi);
- edge true_edge, false_edge, tem;
- tree arg0 = NULL_TREE, arg1 = NULL_TREE;
-
- /* We have to verify that one edge into the PHI node is dominated
- by the true edge of the predicate block and the other edge
- dominated by the false edge. This ensures that the PHI argument
- we are going to take is completely determined by the path we
- take from the predicate block.
- We can only use BB dominance checks below if the destination of
- the true/false edges are dominated by their edge, thus only
- have a single predecessor. */
- extract_true_false_edges_from_block (dom, &true_edge, &false_edge);
- tem = EDGE_PRED (bb, 0);
- if (tem == true_edge
- || (single_pred_p (true_edge->dest)
- && (tem->src == true_edge->dest
- || dominated_by_p (CDI_DOMINATORS,
- tem->src, true_edge->dest))))
- arg0 = PHI_ARG_DEF (phi, tem->dest_idx);
- else if (tem == false_edge
- || (single_pred_p (false_edge->dest)
- && (tem->src == false_edge->dest
- || dominated_by_p (CDI_DOMINATORS,
- tem->src, false_edge->dest))))
- arg1 = PHI_ARG_DEF (phi, tem->dest_idx);
- else
- return false;
- tem = EDGE_PRED (bb, 1);
- if (tem == true_edge
- || (single_pred_p (true_edge->dest)
- && (tem->src == true_edge->dest
- || dominated_by_p (CDI_DOMINATORS,
- tem->src, true_edge->dest))))
- arg0 = PHI_ARG_DEF (phi, tem->dest_idx);
- else if (tem == false_edge
- || (single_pred_p (false_edge->dest)
- && (tem->src == false_edge->dest
- || dominated_by_p (CDI_DOMINATORS,
- tem->src, false_edge->dest))))
- arg1 = PHI_ARG_DEF (phi, tem->dest_idx);
- else
- return false;
- if (!arg0 || !arg1)
+ edge te, fe;
+ if (! extract_true_false_controlled_edges (dom, gimple_bb (phi),
+ &te, &fe))
return false;
if (true_arg_p)
- *true_arg_p = arg0;
+ *true_arg_p = PHI_ARG_DEF (phi, te->dest_idx);
if (false_arg_p)
- *false_arg_p = arg1;
+ *false_arg_p = PHI_ARG_DEF (phi, fe->dest_idx);
return true;
}