From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1011) id CC00C3858005; Wed, 3 Nov 2021 14:38:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC00C3858005 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andrew Macleod To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4869] For ranges, PHIs don't need to process arg == def. X-Act-Checkin: gcc X-Git-Author: Andrew MacLeod X-Git-Refname: refs/heads/master X-Git-Oldrev: b18394ce15639489a91a502d3b9db30d73898191 X-Git-Newrev: 6d936684fcf9bbb55837e3a87ae2221d5ec9b5b7 Message-Id: <20211103143820.CC00C3858005@sourceware.org> Date: Wed, 3 Nov 2021 14:38:20 +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: Wed, 03 Nov 2021 14:38:20 -0000 https://gcc.gnu.org/g:6d936684fcf9bbb55837e3a87ae2221d5ec9b5b7 commit r12-4869-g6d936684fcf9bbb55837e3a87ae2221d5ec9b5b7 Author: Andrew MacLeod Date: Tue Nov 2 09:46:53 2021 -0400 For ranges, PHIs don't need to process arg == def. If an argument of a phi is the same as the DEF of the phi, then the range on the incoming edge doesn't need to be taken into account since it can't be anything other than itself. * gimple-range-fold.cc (fold_using_range::range_of_phi): Don't import a range from edge if arg == phidef. Diff: --- gcc/gimple-range-fold.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc index 6cc7753a750..608d98b43d5 100644 --- a/gcc/gimple-range-fold.cc +++ b/gcc/gimple-range-fold.cc @@ -779,6 +779,10 @@ fold_using_range::range_of_phi (irange &r, gphi *phi, fur_source &src) for (x = 0; x < gimple_phi_num_args (phi); x++) { tree arg = gimple_phi_arg_def (phi, x); + // An argument that is the same as the def provides no new range. + if (arg == phi_def) + continue; + edge e = gimple_phi_arg_edge (phi, x); // Get the range of the argument on its edge.