]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
For ranges, PHIs don't need to process arg == def.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 2 Nov 2021 13:46:53 +0000 (09:46 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 3 Nov 2021 14:13:32 +0000 (10:13 -0400)
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.

gcc/gimple-range-fold.cc

index 6cc7753a750d492e7aac2d0f90be70148b972b3b..608d98b43d53bdea737d4eda14f393387870ac2a 100644 (file)
@@ -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.