diff options
author | Tom de Vries <tom@codesourcery.com> | 2017-12-20 22:47:33 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2017-12-20 22:47:33 +0000 |
commit | 67d2229e8acc9cbf7279fe90c295cc47a60733dd (patch) | |
tree | 789f46faa0c24e05a4fd95e6bb30f06a49818b51 | |
parent | 1679da1571b8c6fee93b05aa65716b60ba220f93 (diff) | |
download | gcc-67d2229e8acc9cbf7279fe90c295cc47a60733dd.zip gcc-67d2229e8acc9cbf7279fe90c295cc47a60733dd.tar.gz gcc-67d2229e8acc9cbf7279fe90c295cc47a60733dd.tar.bz2 |
Simplify fold_internal_goacc_dim
2017-12-20 Tom de Vries <tom@codesourcery.com>
* gimple-fold.c (fold_internal_goacc_dim): Simplify.
From-SVN: r255905
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 20 |
2 files changed, 18 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43c062e..1045167 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-12-20 Tom de Vries <tom@codesourcery.com> + + * gimple-fold.c (fold_internal_goacc_dim): Simplify. + 2017-12-20 Jakub Jelinek <jakub@redhat.com> PR ipa/83506 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 7b3c6db..33eae3e 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3721,15 +3721,23 @@ fold_internal_goacc_dim (const gimple *call) { int axis = oacc_get_ifn_dim_arg (call); int size = oacc_get_fn_dim_size (current_function_decl, axis); - bool is_pos = gimple_call_internal_fn (call) == IFN_GOACC_DIM_POS; tree result = NULL_TREE; + tree type = TREE_TYPE (gimple_call_lhs (call)); - /* If the size is 1, or we only want the size and it is not dynamic, - we know the answer. */ - if (size == 1 || (!is_pos && size)) + switch (gimple_call_internal_fn (call)) { - tree type = TREE_TYPE (gimple_call_lhs (call)); - result = build_int_cst (type, size - is_pos); + case IFN_GOACC_DIM_POS: + /* If the size is 1, we know the answer. */ + if (size == 1) + result = build_int_cst (type, 0); + break; + case IFN_GOACC_DIM_SIZE: + /* If the size is not dynamic, we know the answer. */ + if (size) + result = build_int_cst (type, size); + break; + default: + break; } return result; |