Re: PATCH to use the new gimple_call_internal_p overload

2016-09-26 Thread Jeff Law

On 09/26/2016 07:53 AM, Marek Polacek wrote:

In my recent -Wimplicit-fallthrough patch I introduced a new overload
gimple_call_internal_p to check whether a stmt is a specific internal
function.  So use this predicate in the rest of the codebase, too.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

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.

OK.  Thanks for cleaning this up.

jeff




PATCH to use the new gimple_call_internal_p overload

2016-09-26 Thread Marek Polacek
In my recent -Wimplicit-fallthrough patch I introduced a new overload
gimple_call_internal_p to check whether a stmt is a specific internal
function.  So use this predicate in the rest of the codebase, too.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

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.

diff --git gcc/ipa-inline-analysis.c gcc/ipa-inline-analysis.c
index 132779d..8228e8a 100644
--- gcc/ipa-inline-analysis.c
+++ 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 gcc/ipa-split.c gcc/ipa-split.c
index ac8b478..0c25fca 100644
--- gcc/ipa-split.c
+++ 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 gcc/omp-low.c gcc/omp-low.c
index bf52d84..422f2b2 100644
--- gcc/omp-low.c
+++ 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 ();
diff --git gcc/predict.c gcc/predict.c
index b3d1697..463fd0b 100644
--- gcc/predict.c
+++ 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)
-  &&