Optimising std::find on x86 and PPC
Daniel Berlin
dberlin@dberlin.org
Tue Dec 14 21:56:00 GMT 2004
> | consider the current behavior just a serious (performance) regression
> | (i.e., correctness vs aliasing and other subtleties should not be in
> | the way)
>
> That is a clear regression.
>
> Tree-ssa has been sold on the name of bringing better methodology to
> optimizations; given Theo's analysis, I think this issue no longer
> belongs to V3. It should be brought to GCC main list
The issue i have with this characterization is that we don't have a
tree level unroller that does anything but complete unrolling, so i'm not
sure what tree-ssa has to do with it.
I do agree it's a regression, however, and a serious one (because i trust
the libstdc++ people when they say this will cause them serious
problems).
Just so others have context, the trivially broken loop that Paolo had
sent to me looks like this:
int*
check(int* a, int* b)
{
for (; a < b; ++a)
if (*a == 1)
return a;
return a;
}
This was unrolled with 3.3.3, but 4.0 (and apparently 3.4) claims the
number of iterations is not runtime computable.
This is clearly wrong, as there are no stores in the entire function, so b
couldn't *possible* change, no matter what we do.
:)
--Dan
More information about the Gcc
mailing list