This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/37242] New: missed load PRE-like opportunity
- From: "bonzini at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2008 11:54:16 -0000
- Subject: [Bug tree-optimization/37242] New: missed load PRE-like opportunity
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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