[llvm-commits] [llvm] r150939 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Nick Lewycky nicholas at mxc.ca
Sun Feb 19 19:30:44 PST 2012


Chris Lattner wrote:
>
> On Feb 19, 2012, at 4:37 PM, NAKAMURA Takumi wrote:
>
>> 2012/2/20 Chris Lattner<clattner at apple.com>:
>>> Nice!  It's probably best to rename the "Evaluate" class to "Evaluator".  Also, it can be put into an anon namespace.  Thanks Nick!
>>
>> Rather, could we integrate the evaluators in globalopt,
>> constantfolding (and EE/Interpreter)?
>
> They all do different things (and the interpreter should be killed :), so I don't think it makes sense.

I think it would make sense. They share a design where they visit each 
an instruction/constant-expression with some mapping applied to the 
operands such as building a Constant* or computing a ConstantRange or 
using a SCEV object.

Most clients don't bother with simulating store or a call either because 
it's too hard or because they aren't allowed to (a FunctionPass can't 
enter a callee). It still makes sense to factor out the logic for 
handling these cases and let users disable parts that aren't valid for 
them. The differences just aren't that big.

The next major issue is that some clients want to run the instructions 
eagerly and others lazily. A design based on InstVisitor would allow you 
to walk through blocks eagerly or call back to compute information about 
operands lazily as they're encountered.

Anyhow, if I come back to this topic it'll be with patch in hand, and 
after the Interpreter is dead and buried. :)

Nick



More information about the llvm-commits mailing list