https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108360
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aldyh at gcc dot gnu.org, | |amacleod at redhat dot com, | |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, this used to be optimized out during vrp2, but I'm surprised how the ranger could figure it out. It is true that foo is never called. If b is initially <= 0 (that is actually the case when running the program), then c is 0, f is 1, e is 16, j is 16, j==b is 0 and so g(j==b,k) is -1U; if b is initially > 0, then c is -1, f, e and j are 0, j==b is 0 and so g(j==b,k) is also -1U. I'm just surprised how GCC 12 ranger or old style VRP could figure that out though. Because when it only considers variable ranges, c is ]-1,0], f is [0,1], e and j are [0,16] or [0,0] U [16,16] but that doesn't imply that b (VARYING) == j is actually false or true.