From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 42E763857428; Mon, 13 Sep 2021 15:30:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 42E763857428 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-unswitching-switch-v3)] Use ranger only for supported types. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/loop-unswitching-switch-v3 X-Git-Oldrev: e91cc5544a450f1040f20cc17a13c5983762f01b X-Git-Newrev: 860179d2bcaed07965ce2d2507ebfb8dd384e3e0 Message-Id: <20210913153052.42E763857428@sourceware.org> Date: Mon, 13 Sep 2021 15:30:52 +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: Mon, 13 Sep 2021 15:30:52 -0000 https://gcc.gnu.org/g:860179d2bcaed07965ce2d2507ebfb8dd384e3e0 commit 860179d2bcaed07965ce2d2507ebfb8dd384e3e0 Author: Martin Liska Date: Mon Sep 13 14:36:45 2021 +0200 Use ranger only for supported types. Diff: --- gcc/tree-ssa-loop-unswitch.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index 347cbf443df..0568c283c41 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -388,20 +388,24 @@ tree_unswitch_single_loop (class loop *loop, int num) int_range_max r; edge edge_true, edge_false; extract_true_false_edges_from_block (bbs[i], &edge_true, &edge_false); + tree cond = gimple_cond_lhs (stmt); - if (ranger.range_on_edge (r, edge_true, gimple_cond_lhs (stmt)) - && r.undefined_p ()) + if (r.supports_type_p (TREE_TYPE (cond))) { - gimple_cond_set_condition_from_tree (condition, - boolean_false_node); - changed = true; - } - else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt)) - && r.undefined_p ()) - { - gimple_cond_set_condition_from_tree (condition, - boolean_true_node); - changed = true; + if (ranger.range_on_edge (r, edge_true, cond) + && r.undefined_p ()) + { + gimple_cond_set_condition_from_tree (condition, + boolean_false_node); + changed = true; + } + else if(ranger.range_on_edge (r, edge_false, gimple_cond_lhs (stmt)) + && r.undefined_p ()) + { + gimple_cond_set_condition_from_tree (condition, + boolean_true_node); + changed = true; + } } } else if (swtch != NULL)