This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/24427] New: missing optimization opportunity with binary operators


In the code below, the test is always true and could be found as such by using
distributivity on binary operators to factor out constant values.  This is not
currently done, by looking at the assembly code produced.

<code>
extern int f(unsigned);

int f(unsigned u)
{
  if( (u|4) & 6 ) /* could be tested as (u&6) || (4&6), always true */
    return 5;
  else
    return 10;
}
</code>


-- 
           Summary: missing optimization opportunity with binary operators
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P4
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dvilleneuve at kronos dot com
GCC target triplet: i386-redhat-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24427


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]