[Bug tree-optimization/93447] Value range propagation not working at -Os

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 17 07:15:21 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93447

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement
   Last reconfirmed|                            |2021-12-17
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Here is a simple testcase which shows the issue even

/* { dg-do compile } */
/* { dg-options "-Os -fdump-tree-optimized" } */
_Bool g(int, int, int *a);

_Bool addb_simple(int A, int B, int *Rp)
{
    int ec=0;
    if(g(A,B,Rp)) 
        ec = -777;
    return !!ec;
}
/* The call to g should be tail called. */
/* { dg-final { scan-tree-dump-times "tail call" 1 "optimized"} } */


PRE for -Os does not do partial redundancy elimination, only code hoisting and
fully redundancy elimination which is why it is not doing it for -Os. What PRE
does not notice is d_5 is not being used so it is fully redundant but I don't
know if PRE/FRE is the right place for this.


More information about the Gcc-bugs mailing list