[LLVMdev] value tracking
criswell at cs.uiuc.edu
Tue Jan 20 12:09:13 CST 2009
Nuno Lopes wrote:
> I've been thinking about a (potentially lazy) value tracking analysis that
> could be reused by several optimization passes. I don't know if it exists in
> llvm or not, but to my better knowledge it does not. ok there exists the
> ValueTracking class, but it does not provide a function like e.g.
> MayHaveTheValue(Value* v, APSInt x) to check if a given var v may ever have
> the value x
> My proposal:
> - create a value tracking analysis interface that can provide extensive
> info about vars (e.g. the set of possible values for a given vars, etc..)
> - implement that interface in several ways with different tradeoffs of
> preciseness vs speed (e.g. range analysis, value set tracking, path
> sensitive or not, interprocedural, etc..)
I think the analysis group idea is a good idea. A standardized
interface for querying this sort of information makes code reuse between
LLVM developers doing different projects easier.
As an example of another transform which requires such information, in
the memory safety work that we do, we have transforms that could benefit
from knowing the range of values that an integer value can take
(specifically, we're usually interested in the min and max values a GEP
index can have). Having a standardized interface would allow us to
re-use analysis passes developed by other LLVM contributors for other
applications, and if we develop a pass that computes such information
more aggressively, it makes it easier for us to write that code in a way
that is usable by the LLVM community at large.
-- John T.
> I believe this could reuse some code from PredSimplify and hopefully make it
> a very simple pass (as much of the work would then be hidden in the value
> tracking analysis).
> Having this sort of readily available analysis would allow us to build other
> optimization more easily. I've already a few ideas in mind (I've implemented
> one of them, but I had to unnecessarily implement too much of this value
> tracking logic).
> Any ideas, opinions, etc..?
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
More information about the LLVMdev