From bd79788195e59b579bfcc495ef042c6d2c65e264 Mon Sep 17 00:00:00 2001 From: vries Date: Mon, 29 Jun 2015 13:53:32 +0000 Subject: [PATCH] Simplify structure try_transform_to_exit_first_loop_alt 2015-06-29 Tom de Vries * tree-parloops.c (try_transform_to_exit_first_loop_alt): Simplify function structure. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225119 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/tree-parloops.c | 59 ++++++++++++++--------------------------------------- 2 files changed, 20 insertions(+), 44 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b773b4bd30a..4427fd48702 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-06-29 Tom de Vries + + * tree-parloops.c (try_transform_to_exit_first_loop_alt): Simplify + function structure. + 2015-06-29 Matthew Wahab * doc/invoke.texi (Aarch64 Options, -march): Split out arch and diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index ab77f32372a..ec708c67ac9 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1788,60 +1788,31 @@ try_transform_to_exit_first_loop_alt (struct loop *loop, nit, build_one_cst (nit_type)); gcc_assert (TREE_CODE (alt_bound) == INTEGER_CST); + transform_to_exit_first_loop_alt (loop, reduction_list, alt_bound); + return true; } else { /* Todo: Figure out if we can trigger this, if it's worth to handle optimally, and if we can handle it optimally. */ + return false; } } - else - { - gcc_assert (TREE_CODE (nit) == SSA_NAME); - - gimple def = SSA_NAME_DEF_STMT (nit); - - if (def - && is_gimple_assign (def) - && gimple_assign_rhs_code (def) == PLUS_EXPR) - { - tree op1 = gimple_assign_rhs1 (def); - tree op2 = gimple_assign_rhs2 (def); - if (integer_minus_onep (op1)) - alt_bound = op2; - else if (integer_minus_onep (op2)) - alt_bound = op1; - } - /* There is a number of test-cases for which we don't get an alt_bound - here: they're listed here, with the lhs of the last stmt as the nit: + gcc_assert (TREE_CODE (nit) == SSA_NAME); - libgomp.graphite/force-parallel-1.c: - _21 = (signed long) N_6(D); - _19 = _21 + -1; - _7 = (unsigned long) _19; + gimple def = SSA_NAME_DEF_STMT (nit); - libgomp.graphite/force-parallel-2.c: - _33 = (signed long) N_9(D); - _16 = _33 + -1; - _37 = (unsigned long) _16; - - libgomp.graphite/force-parallel-5.c: - : - # graphite_IV.5_46 = PHI <0(5), graphite_IV.5_47(11)> - : - _33 = (unsigned long) graphite_IV.5_46; - - g++.dg/tree-ssa/pr34355.C: - _2 = (unsigned int) i_9; - _3 = 4 - _2; - - gcc.dg/pr53849.c: - _5 = d.0_11 + -2; - _18 = (unsigned int) _5; - - We will be able to handle some of these cases, if we can determine when - it's safe to look past casts. */ + if (def + && is_gimple_assign (def) + && gimple_assign_rhs_code (def) == PLUS_EXPR) + { + tree op1 = gimple_assign_rhs1 (def); + tree op2 = gimple_assign_rhs2 (def); + if (integer_minus_onep (op1)) + alt_bound = op2; + else if (integer_minus_onep (op2)) + alt_bound = op1; } if (alt_bound == NULL_TREE) -- 2.11.4.GIT