From: Marek Polacek Date: Mon, 26 Sep 2016 15:50:13 +0000 (+0000) Subject: ipa-inline-analysis.c (find_foldable_builtin_expect): Use gimple_call_internal_p. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8e4284d0b24bd3c745c054054d673ed306d30467;p=gcc.git ipa-inline-analysis.c (find_foldable_builtin_expect): Use gimple_call_internal_p. * ipa-inline-analysis.c (find_foldable_builtin_expect): Use gimple_call_internal_p. * ipa-split.c (find_return_bb): Likewise. (execute_split_functions): Likewise. * omp-low.c (dump_oacc_loop_part): Likewise. (oacc_loop_xform_head_tail): Likewise. * predict.c (predict_loops): Likewise. * sanopt.c (pass_sanopt::execute): Likewise. * tree-cfg.c (get_abnormal_succ_dispatcher): Likewise. * tree-parloops.c (oacc_entry_exit_ok_1): Likewise. * tree-stdarg.c (gimple_call_ifn_va_arg_p): Remove function. (expand_ifn_va_arg_1): Use gimple_call_internal_p. (expand_ifn_va_arg): Likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise. (optimize_mask_stores): Likewise. * tree-vect-stmts.c (vect_simd_lane_linear): Likewise. (vect_transform_stmt): Likewise. * tree-vectorizer.c (vect_loop_vectorized_call): Likewise. * tsan.c (instrument_memory_accesses): Likewise. From-SVN: r240498 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfccbb460ea..9427b506007 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2016-09-26 Marek Polacek + + * ipa-inline-analysis.c (find_foldable_builtin_expect): Use + gimple_call_internal_p. + * ipa-split.c (find_return_bb): Likewise. + (execute_split_functions): Likewise. + * omp-low.c (dump_oacc_loop_part): Likewise. + (oacc_loop_xform_head_tail): Likewise. + * predict.c (predict_loops): Likewise. + * sanopt.c (pass_sanopt::execute): Likewise. + * tree-cfg.c (get_abnormal_succ_dispatcher): Likewise. + * tree-parloops.c (oacc_entry_exit_ok_1): Likewise. + * tree-stdarg.c (gimple_call_ifn_va_arg_p): Remove function. + (expand_ifn_va_arg_1): Use gimple_call_internal_p. + (expand_ifn_va_arg): Likewise. + * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise. + (optimize_mask_stores): Likewise. + * tree-vect-stmts.c (vect_simd_lane_linear): Likewise. + (vect_transform_stmt): Likewise. + * tree-vectorizer.c (vect_loop_vectorized_call): Likewise. + * tsan.c (instrument_memory_accesses): Likewise. + 2016-09-26 Kyrylo Tkachov Alexander Monakov diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c index 132779d2621..8228e8ae3e8 100644 --- a/gcc/ipa-inline-analysis.c +++ b/gcc/ipa-inline-analysis.c @@ -2398,9 +2398,7 @@ find_foldable_builtin_expect (basic_block bb) { gimple *stmt = gsi_stmt (bsi); if (gimple_call_builtin_p (stmt, BUILT_IN_EXPECT) - || (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_BUILTIN_EXPECT)) + || gimple_call_internal_p (stmt, IFN_BUILTIN_EXPECT)) { tree var = gimple_call_lhs (stmt); tree arg = gimple_call_arg (stmt, 0); diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index ac8b4787b10..0c25fcae59f 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -788,9 +788,7 @@ find_return_bb (void) /* For -fsanitize=thread, allow also TSAN_FUNC_EXIT () in the return bb. */ else if ((flag_sanitize & SANITIZE_THREAD) - && is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_TSAN_FUNC_EXIT) + && gimple_call_internal_p (stmt, IFN_TSAN_FUNC_EXIT)) ; else break; @@ -1840,9 +1838,7 @@ execute_split_functions (void) } if ((flag_sanitize & SANITIZE_THREAD) - && is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_TSAN_FUNC_EXIT) + && gimple_call_internal_p (stmt, IFN_TSAN_FUNC_EXIT)) { /* We handle TSAN_FUNC_EXIT for splitting either in the return_bb, or in its immediate predecessors. */ diff --git a/gcc/omp-low.c b/gcc/omp-low.c index bf52d849d9e..422f2b20c37 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -19047,9 +19047,7 @@ dump_oacc_loop_part (FILE *file, gcall *from, int depth, { gimple *stmt = gsi_stmt (gsi); - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_UNIQUE) + if (gimple_call_internal_p (stmt, IFN_UNIQUE)) { enum ifn_unique_kind k = ((enum ifn_unique_kind) TREE_INT_CST_LOW @@ -19271,10 +19269,8 @@ oacc_loop_xform_head_tail (gcall *from, int level) for (gimple_stmt_iterator gsi = gsi_for_stmt (from);;) { gimple *stmt = gsi_stmt (gsi); - - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_UNIQUE) + + if (gimple_call_internal_p (stmt, IFN_UNIQUE)) { enum ifn_unique_kind k = ((enum ifn_unique_kind) @@ -19285,9 +19281,7 @@ oacc_loop_xform_head_tail (gcall *from, int level) else if (k == kind && stmt != from) break; } - else if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_GOACC_REDUCTION) + else if (gimple_call_internal_p (stmt, IFN_GOACC_REDUCTION)) *gimple_call_arg_ptr (stmt, 3) = replacement; gsi_next (&gsi); diff --git a/gcc/predict.c b/gcc/predict.c index b3d169770c9..463fd0b610e 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -2024,9 +2024,7 @@ predict_loops (void) && gimple_expr_code (call_stmt) == NOP_EXPR && TREE_CODE (gimple_assign_rhs1 (call_stmt)) == SSA_NAME) call_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (call_stmt)); - if (gimple_code (call_stmt) == GIMPLE_CALL - && gimple_call_internal_p (call_stmt) - && gimple_call_internal_fn (call_stmt) == IFN_BUILTIN_EXPECT + if (gimple_call_internal_p (call_stmt, IFN_BUILTIN_EXPECT) && TREE_CODE (gimple_call_arg (call_stmt, 2)) == INTEGER_CST && tree_fits_uhwi_p (gimple_call_arg (call_stmt, 2)) && tree_to_uhwi (gimple_call_arg (call_stmt, 2)) diff --git a/gcc/sanopt.c b/gcc/sanopt.c index eeb4cd00de0..27c43da539f 100644 --- a/gcc/sanopt.c +++ b/gcc/sanopt.c @@ -686,8 +686,7 @@ pass_sanopt::execute (function *fun) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - if (is_gimple_call (stmt) && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_ASAN_CHECK) + if (gimple_call_internal_p (stmt, IFN_ASAN_CHECK)) ++asan_num_accesses; } } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index badbd96951c..2ed450c4cab 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -621,10 +621,7 @@ get_abnormal_succ_dispatcher (basic_block bb) gimple_stmt_iterator gsi = gsi_start_nondebug_after_labels_bb (e->dest); gimple *g = gsi_stmt (gsi); - if (g - && is_gimple_call (g) - && gimple_call_internal_p (g) - && gimple_call_internal_fn (g) == IFN_ABNORMAL_DISPATCHER) + if (g && gimple_call_internal_p (g, IFN_ABNORMAL_DISPATCHER)) return e->dest; } return NULL; diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index a16015271a1..4779441b0cf 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2990,9 +2990,7 @@ oacc_entry_exit_ok_1 (bitmap in_loop_bbs, vec region_bbs, && !gimple_vdef (stmt) && !gimple_vuse (stmt)) continue; - else if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_GOACC_DIM_POS) + else if (gimple_call_internal_p (stmt, IFN_GOACC_DIM_POS)) continue; else if (gimple_code (stmt) == GIMPLE_RETURN) continue; diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c index f72a60b9362..0c5e4309206 100644 --- a/gcc/tree-stdarg.c +++ b/gcc/tree-stdarg.c @@ -991,16 +991,6 @@ finish: } } -/* Return true if STMT is IFN_VA_ARG. */ - -static bool -gimple_call_ifn_va_arg_p (gimple *stmt) -{ - return (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_VA_ARG); -} - /* Expand IFN_VA_ARGs in FUN. */ static void @@ -1018,7 +1008,7 @@ expand_ifn_va_arg_1 (function *fun) tree ap, aptype, expr, lhs, type; gimple_seq pre = NULL, post = NULL; - if (!gimple_call_ifn_va_arg_p (stmt)) + if (!gimple_call_internal_p (stmt, IFN_VA_ARG)) continue; modified = true; @@ -1116,7 +1106,7 @@ expand_ifn_va_arg (function *fun) gimple_stmt_iterator i; FOR_EACH_BB_FN (bb, fun) for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) - gcc_assert (!gimple_call_ifn_va_arg_p (gsi_stmt (i))); + gcc_assert (!gimple_call_internal_p (gsi_stmt (i), IFN_VA_ARG)); } } diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 58f3456fe40..a84ca3f2f34 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -424,9 +424,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo) else { gcc_assert (!STMT_VINFO_DATA_REF (stmt_info)); - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_MASK_STORE) + if (gimple_call_internal_p (stmt, IFN_MASK_STORE)) scalar_type = TREE_TYPE (gimple_call_arg (stmt, 3)); else scalar_type = TREE_TYPE (gimple_get_lhs (stmt)); @@ -7180,9 +7178,7 @@ optimize_mask_stores (struct loop *loop) gsi_next (&gsi)) { stmt = gsi_stmt (gsi); - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_MASK_STORE) + if (gimple_call_internal_p (stmt, IFN_MASK_STORE)) worklist.safe_push (stmt); } } diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index dbbd731a12d..47770adcdc0 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3003,9 +3003,7 @@ vect_simd_lane_linear (tree op, struct loop *loop, default: return; } - else if (is_gimple_call (def_stmt) - && gimple_call_internal_p (def_stmt) - && gimple_call_internal_fn (def_stmt) == IFN_GOMP_SIMD_LANE + else if (gimple_call_internal_p (def_stmt, IFN_GOMP_SIMD_LANE) && loop->simduid && TREE_CODE (gimple_call_arg (def_stmt, 0)) == SSA_NAME && (SSA_NAME_VAR (gimple_call_arg (def_stmt, 0)) @@ -8446,9 +8444,7 @@ vect_transform_stmt (gimple *stmt, gimple_stmt_iterator *gsi, case call_vec_info_type: done = vectorizable_call (stmt, gsi, &vec_stmt, slp_node); stmt = gsi_stmt (*gsi); - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_MASK_STORE) + if (gimple_call_internal_p (stmt, IFN_MASK_STORE)) is_store = true; break; diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index 1d55041fb22..22e587afb4c 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -436,9 +436,7 @@ vect_loop_vectorized_call (struct loop *loop) if (!gsi_end_p (gsi)) { g = gsi_stmt (gsi); - if (is_gimple_call (g) - && gimple_call_internal_p (g) - && gimple_call_internal_fn (g) == IFN_LOOP_VECTORIZED + if (gimple_call_internal_p (g, IFN_LOOP_VECTORIZED) && (tree_to_shwi (gimple_call_arg (g, 0)) == loop->num || tree_to_shwi (gimple_call_arg (g, 1)) == loop->num)) return g; diff --git a/gcc/tsan.c b/gcc/tsan.c index aba21f81bd6..91dbd41a0b4 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -779,9 +779,7 @@ instrument_memory_accesses (void) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); - if (is_gimple_call (stmt) - && gimple_call_internal_p (stmt) - && gimple_call_internal_fn (stmt) == IFN_TSAN_FUNC_EXIT) + if (gimple_call_internal_p (stmt, IFN_TSAN_FUNC_EXIT)) { if (fentry_exit_instrument) replace_func_exit (stmt);