summaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authordpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-08 20:21:15 +0000
committerdpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-08 20:21:15 +0000
commit663ac2be9bed43e6eac368be44c7caa80b221ad4 (patch)
tree5bd13dafae634219e30f383bea77e97014e3ee50 /gcc/tree-if-conv.c
parente3f528548e0b487b1381ef88a5dfc61175575a07 (diff)
downloadgcc-663ac2be9bed43e6eac368be44c7caa80b221ad4.tar.gz
PR tree-optimization/23115
* tree-if-conv.c (find_phi_replacement_condition): Check domninated_by relation. * gcc.dg/tree-ssa/pr23115.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106653 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 303ae2b659d..5d8375d412e 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -679,7 +679,7 @@ find_phi_replacement_condition (struct loop *loop,
S2: x = c ? b : a;
S2 is preferred over S1. Make 'b' first_bb and use its condition.
-
+
2) Do not make loop header first_bb.
3)
@@ -691,7 +691,10 @@ find_phi_replacement_condition (struct loop *loop,
S3: x = (c == d) ? b : a;
S3 is preferred over S1 and S2*, Make 'b' first_bb and use
- its condition. */
+ its condition.
+
+ 4) If pred B is dominated by pred A then use pred B's condition.
+ See PR23115. */
/* Select condition that is not TRUTH_NOT_EXPR. */
tmp_cond = first_bb->aux;
@@ -703,8 +706,10 @@ find_phi_replacement_condition (struct loop *loop,
second_bb = tmp_bb;
}
- /* Check if FIRST_BB is loop header or not. */
- if (first_bb == loop->header)
+ /* Check if FIRST_BB is loop header or not and make sure that
+ FIRST_BB does not dominate SECOND_BB. */
+ if (first_bb == loop->header
+ || dominated_by_p (CDI_DOMINATORS, second_bb, first_bb))
{
tmp_cond = second_bb->aux;
if (TREE_CODE (tmp_cond) == TRUTH_NOT_EXPR)