diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2015-10-30 12:54:32 -0200 |
---|---|---|
committer | Alexandre Oliva <aoliva@redhat.com> | 2015-10-30 12:54:32 -0200 |
commit | 93df5c06bb11137b56865cbec2cde9b67eaaf246 (patch) | |
tree | 257240e8c42da732174a179aa5b2a02006fb22a6 | |
parent | 3c7e477b5e96ed74174e8c618e361e14a5891ba1 (diff) | |
download | gcc-aoliva/pr68083.tar.gz |
ifcombine: factor out inner block viability testaoliva/pr68083
Bail out early if the inner block has side effects or is otherwise not
eligible for ifcombine.
for gcc/ChangeLog
* tree-ssa-ifcombine.c (tree_ssa_ifcombine_bb_1): Factor out
bb_no_side_effects_p tests...
(tree_ssa_ifcombine_bb): ... here.
-rw-r--r-- | gcc/tree-ssa-ifcombine.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 622dc6b679d..3b60968f948 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -579,8 +579,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, the inner cond_bb having no side-effects. */ if (phi_pred_bb != else_bb && recognize_if_then_else (outer_cond_bb, &inner_cond_bb, &else_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb)) { /* We have <outer_cond_bb> @@ -598,8 +597,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, /* And a version where the outer condition is negated. */ if (phi_pred_bb != else_bb && recognize_if_then_else (outer_cond_bb, &else_bb, &inner_cond_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb)) { /* We have <outer_cond_bb> @@ -620,8 +618,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, having no side-effects. */ if (phi_pred_bb != then_bb && recognize_if_then_else (outer_cond_bb, &then_bb, &inner_cond_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb)) { /* We have <outer_cond_bb> @@ -638,8 +635,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, /* And a version where the outer condition is negated. */ if (phi_pred_bb != then_bb && recognize_if_then_else (outer_cond_bb, &inner_cond_bb, &then_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb)) { /* We have <outer_cond_bb> @@ -676,7 +672,8 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb) if (a && b) ; This requires a single predecessor of the inner cond_bb. */ - if (single_pred_p (inner_cond_bb)) + if (single_pred_p (inner_cond_bb) + && bb_no_side_effects_p (inner_cond_bb)) { basic_block outer_cond_bb = single_pred (inner_cond_bb); |