From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 300EE3858430; Tue, 16 Nov 2021 13:41:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 300EE3858430 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/loop-unswitch-improvement)] Add debug counter and fix a typo. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitch-improvement X-Git-Oldrev: d71c195cfd007b0bfe5922e018e7316bf7096c91 X-Git-Newrev: 04edc54cd400f925e612c996dfd4b1bce3c533e0 Message-Id: <20211116134157.300EE3858430@sourceware.org> Date: Tue, 16 Nov 2021 13:41:57 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2021 13:41:57 -0000 https://gcc.gnu.org/g:04edc54cd400f925e612c996dfd4b1bce3c533e0 commit 04edc54cd400f925e612c996dfd4b1bce3c533e0 Author: Martin Liska Date: Tue Nov 16 14:41:42 2021 +0100 Add debug counter and fix a typo. Diff: --- gcc/dbgcnt.def | 1 + gcc/tree-ssa-loop-unswitch.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index f8a15f3d1d1..278fb1112b3 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -187,6 +187,7 @@ DEBUG_COUNTER (ira_move) DEBUG_COUNTER (ivopts_loop) DEBUG_COUNTER (lim) DEBUG_COUNTER (local_alloc_for_sched) +DEBUG_COUNTER (loop_unswitch) DEBUG_COUNTER (match) DEBUG_COUNTER (merged_ipa_icf) DEBUG_COUNTER (phiopt_edge_range) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index fb5bcf5a13d..74619ed8b24 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-ssa-loop-manip.h" #include "tree-pretty-print.h" #include "gimple-range.h" +#include "dbgcnt.h" /* This file implements the loop unswitching, i.e. transformation of loops like @@ -255,7 +256,7 @@ tree_may_unswitch_on (basic_block bb, class loop *loop, gimple_ranger *ranger) if (irange::supports_type_p (TREE_TYPE (lhs))) { ranger->range_on_edge (predicate->true_range, edge_true, lhs); - ranger->range_on_edge (predicate->false_range, edge_false, rhs); + ranger->range_on_edge (predicate->false_range, edge_false, lhs); } return predicate; @@ -479,6 +480,9 @@ tree_unswitch_single_loop (class loop *loop, int num, gimple_ranger *ranger, goto exit; } + if (!dbg_cnt (loop_unswitch)) + goto exit; + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, ";; Unswitching loop with condition: ");