[Bug tree-optimization/126704] [17 Regression] Missing or not complete global range after VRP2 (with and without dom) since r17-1845

"pinskia at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126704

Drea Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |17.0
   Last reconfirmed|                            |2026-08-12
            Summary|Missing or not complete     |[17 Regression] Missing or
                   |global range after VRP2     |not complete global range
                   |(with and without dom)      |after VRP2 (with and
                   |                            |without dom) since r17-1845
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So the DCE issue is reassociation not removing statements no longer reference.

Let me look into that next.

Optimizing range tests i_4 +[, 99999] and +[0, 99999]
 into (unsigned int) i_4 <= 99999
Transforming _8 = _6 | _7;
 into _8 = _11;

Transforming:
  i.0_1 = (unsigned int) i_4;
  _6 = i.0_1 > 99999;
  _7 = i_4 > 99999;
  _8 = _6 | _7;

into:
  i.0_1 = (unsigned int) i_4;
  _6 = i.0_1 > 99999;
  _12 = (unsigned int) i_4;
  _11 = _12 > 99999;
  _7 = i_4 > 99999;
  _8 = _11;
  if (_8 != 0)

Looks like the reassociation issue is the issue with DOM too.


But there looks like a missing match pattern here for:
  i.0_1 = (unsigned int) i_4;
  _6 = i.0_1 > 99999;
  _7 = i_4 > 99999;
  _8 = _6 | _7;

into:
i.0_1 > 99999

Which would have fixed the issue too.

The missed optimization is also a regression. It was exposed by
r17-1845-g23b6a9a41a5c05 .

So I will implement two patches, one for the missed match pattern and one for
the reassociation.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.