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

Frits van Bommel fvbommel at gmail.com
Tue Mar 1 06:38:46 PST 2011


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.




More information about the llvm-commits mailing list