[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
Daniel Berlin
dberlin at dberlin.org
Fri Aug 22 17:50:07 PDT 2008
On Fri, Aug 22, 2008 at 5:49 PM, John Regehr <regehr at cs.utah.edu> wrote:
>> Thanks! This is all very interesting, and tells me that LLVM has a
>> way to go to fully support all of these capabilities (if that is the
>> right thing to do, which isn't clear). OTOH, it looks like a lot of
>> real-world software that is using LLVM already doesn't seem to be
>> affected by the lack of them.
>
> LLVM's current choice is safe for all applications. The trapping behavior
> would be a really nice addition, though.
>
> Has anyone quantified the optimizations afforded by undefined signed
> overflow? I'd expect that the benefits are minimal for most codes. On
> the other hand I've seen reports that gcc's -fwrapv hurts performance of
> gcc output significantly. I'm not sure if that is true. Also, it could
> be the case that -fwrapv is implemented poorly.
No, it's not implemented badly. We've quantified it's performance
before and it hurts about 3-5 without high level loop
opts/vectorization on. With them on, they do roughly nothing in the
presence of -fwrapv because you can't determine bounds of any non
trivial loop.
take a simple loop
void foo(int a)
{
for (int i = 0; i < a; i += 2)
{
}
}
If you assume signed overflow is undefined, this loop iterates at max,
a/2 times.
If you assume it is defined to wraparound, it can iterate forever
(consider a == INT_MAX)
More information about the llvm-dev
mailing list