From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80263 invoked by alias); 26 Sep 2016 13:53:29 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 80244 invoked by uid 89); 26 Sep 2016 13:53:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:tree_in, 11067, *gsi, gsi_for_stmt X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Sep 2016 13:53:25 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 322F0135C7 for ; Mon, 26 Sep 2016 13:53:24 +0000 (UTC) Received: from redhat.com (ovpn-204-20.brq.redhat.com [10.40.204.20]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8QDrLcj019921 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 26 Sep 2016 09:53:23 -0400 Date: Mon, 26 Sep 2016 14:01:00 -0000 From: Marek Polacek To: GCC Patches Subject: PATCH to use the new gimple_call_internal_p overload Message-ID: <20160926135320.GL3223@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.0 (2016-08-17) X-SW-Source: 2016-09/txt/msg01834.txt.bz2 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 (&gsi); 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) - && 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 gcc/sanopt.c gcc/sanopt.c index eeb4cd0..27c43da 100644 --- gcc/sanopt.c +++ 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 gcc/tree-cfg.c gcc/tree-cfg.c index badbd96..2ed450c 100644 --- gcc/tree-cfg.c +++ 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 gcc/tree-parloops.c gcc/tree-parloops.c index a160152..4779441 100644 --- gcc/tree-parloops.c +++ 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 gcc/tree-stdarg.c gcc/tree-stdarg.c index f72a60b..0c5e430 100644 --- gcc/tree-stdarg.c +++ 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 gcc/tree-vect-loop.c gcc/tree-vect-loop.c index 58f3456..a84ca3f 100644 --- gcc/tree-vect-loop.c +++ 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 gcc/tree-vect-stmts.c gcc/tree-vect-stmts.c index dbbd731..47770ad 100644 --- gcc/tree-vect-stmts.c +++ 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 gcc/tree-vectorizer.c gcc/tree-vectorizer.c index 1d55041..22e587a 100644 --- gcc/tree-vectorizer.c +++ 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 gcc/tsan.c gcc/tsan.c index aba21f8..91dbd41 100644 --- gcc/tsan.c +++ 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); Marek