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

Duncan Sands baldrick at free.fr
Tue Mar 1 06:40:33 PST 2011


Hi Frits,

> On Tue, Mar 1, 2011 at 11:29 AM, Duncan Sands<baldrick at free.fr>  wrote:
>>> Okay, I follow you now. I just committed a fix to llvm to make the NoFolder work
>>> with the IRBuilder again, and I'm doing a build of llvm-gcc with the NoFolder now.
>>
>> it would be nice if this (folding vs no folding) could be controlled with a
>> runtime flag.  If it was I would probably add it permanently to dragonegg.
>> Unfortunately the way IRBuilder is declared to take the folder as a template
>> parameter makes this hard.  Any ideas for how to achieve this?
>
> 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.

Ciao, Duncan.



More information about the llvm-commits mailing list