[llvm-commits] [PATCH] Refactoring MemoryBuiltin Analysis

Nuno Lopes nunoplopes at sapo.pt
Mon Jun 25 10:25:15 PDT 2012


Hi,

Thanks for your reviews!
I think I've now addressed all the suggestions you pointed out.

Quoting Nick Lewycky <nlewycky at google.com>:

> So, one other thing I was thinking. We're potentially visiting the same
> instruction chain twice. ObjectSizeOffsetVisitor isn't caching, which means
> that calling the evaluator on a chain of instructions like:
> void foo(A) {
>   B = A + 1
>   C = B + 1
>   D = C + 1
>   // ...
>   Z = Y + 1
> if we call the evaluator on Z we'll end up calling the visitor on Y which
> will traverse up to A then fail, then the evaluator will walk to Y and call
> the visitor on X which will do the same traversal (minus one) and fail.
> Ultimately this is O(n^2).
>
> One fix is to add caching, but can we do better?

The Visitor should be pretty quick, since it will fail as soon as it  
finds something that is too complex to analyze statically.
I've run it already on big code bases (> 1M LoC) and I didn't find any  
performance problem. I believe this procedure is consistent to what  
SCEV does: cache only where it's expensive to recompute, otherwise we  
end up filling up the cache with too much junk.
I think caching is the way to go if performance turns out to be a problem..

Thanks,
Nuno



More information about the llvm-commits mailing list