[llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr

Frits van Bommel fvbommel at gmail.com
Tue Mar 1 06:43:48 PST 2011


On Tue, Mar 1, 2011 at 3:40 PM, Duncan Sands <baldrick at free.fr> wrote:
>> On Tue, Mar 1, 2011 at 11:29 AM, Duncan Sands<baldrick at free.fr>  wrote:
>> If it's just about folding versus not folding in the IRBuilder, a
>> simple solution might be to just add a boolean property
>> 'FoldingEnabled' (defaulting to true) to IRBuilder, and add an 'if
>> (FoldingEnabled)' around all the 'if (Constant *Foo =
>> dyn_cast<Constant>(...))' instances.
>> Then at runtime the user of IRBuilder could just call
>> 'Builder.setFoldingEnabled(false)', for example in response to some
>> command-line flag.
>
> thanks for the suggestion.  I guess another way of doing this is to create a
> new
> folder class that dispatches to a target folder or a no folder depending on
> the
> value of some flag.

A MaybeFolder? :)

Yeah, that could work. It would certainly be a nice way to make sure
there's no overhead unless the client intends to use it.




More information about the llvm-commits mailing list