public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/37242]  New: missed load PRE-like opportunity
@ 2008-08-26 11:55 bonzini at gnu dot org
  2008-08-26 11:57 ` [Bug tree-optimization/37242] " bonzini at gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 24+ messages in thread
From: bonzini at gnu dot org @ 2008-08-26 11:55 UTC (permalink / raw)
  To: gcc-bugs

In the attached code, the if-conversion opportunity in PR37240 does not benefit
a Pentium 4.  However, there is another optimization possible on both systems,
namely changing

    while ((maxIdx += maxIdx) < last) {
        if (numbers[maxIdx] < numbers[maxIdx + 1]) maxIdx++;
        if (tmp >= numbers[maxIdx]) break;
        numbers[top] = numbers[maxIdx];
        top = maxIdx;
    }

to

    while ((maxIdx += maxIdx) < last) {
        int a = numbers[maxIdx], b = numbers[maxIdx + 1];
        if (a < b) maxIdx++, a = b;
        if (tmp >= a) break;
        numbers[top] = a;
        top = maxIdx;
    }

It seems to me that numbers[maxIdx] is partially redundant (it is available if
maxIdx++ is not executed).  If an additional load of numbers[maxIdx + 1] is
inserted in the "then" branch, it can also be found to be fully redundant so
that copy propagation generates the optimized code.

This gives a ~3% performance increase on i686-pc-linux-gnu for this benchmark.


-- 
           Summary: missed load PRE-like opportunity
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bonzini at gnu dot org
GCC target triplet: i686-pc-linux-gnu
 BugsThisDependsOn: 37239


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


^ permalink raw reply	[flat|nested] 24+ messages in thread
[parent not found: <bug-37242-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-06-29  0:20 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-26 11:55 [Bug tree-optimization/37242] New: missed load PRE-like opportunity bonzini at gnu dot org
2008-08-26 11:57 ` [Bug tree-optimization/37242] " bonzini at gnu dot org
2008-08-26 12:03 ` [Bug tree-optimization/37242] missed FRE opportunity bonzini at gnu dot org
2008-08-26 21:17 ` [Bug tree-optimization/37242] missed FRE opportunity because of signedness of addition pinskia at gcc dot gnu dot org
2008-08-27  6:42 ` bonzini at gnu dot org
2008-08-27  7:16 ` bonzini at gnu dot org
2008-08-27  7:16 ` bonzini at gnu dot org
2008-08-27  9:42 ` rguenther at suse dot de
2008-08-27 17:51 ` bonzini at gnu dot org
2008-08-27 19:13 ` rguenther at suse dot de
2008-08-27 19:55 ` bonzini at gnu dot org
2008-08-27 20:18 ` rguenther at suse dot de
2008-08-28  6:10 ` bonzini at gnu dot org
2008-08-28  6:18 ` bonzini at gnu dot org
2008-08-28  8:03 ` rguenther at suse dot de
2008-08-28  8:43 ` bonzini at gnu dot org
2008-08-28  8:47 ` rguenther at suse dot de
2008-08-28  8:58 ` bonzini at gnu dot org
2008-08-28  8:59 ` bonzini at gnu dot org
2008-08-29  4:39 ` pinskia at gcc dot gnu dot org
     [not found] <bug-37242-4@http.gcc.gnu.org/bugzilla/>
2011-04-27 17:57 ` matt at use dot net
2011-04-28  9:53 ` rguenth at gcc dot gnu.org
2012-04-18 22:51 ` pinskia at gcc dot gnu.org
2012-06-29  0:20 ` matt at use dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).