[llvm-commits] [PATCH] Teach IRBuilder about simplifying BinOp(Value, Constant)

Duncan Sands baldrick at free.fr
Mon Dec 29 04:34:57 PST 2008


Hi Edwin,

> We now have a NoopFolder, ConstantFolder, and TargetFolder.
> 
> Should the simplifications be part of ConstantFolder, or should there be
> a 4th "folder" like this:
> NoopFolder, ConstantFolder, SimplifyingConstantFolder (derived from
> ConstantFolder), TargetFolder (derived from SimplifyingConstantFolder)?

I think it should be part of ConstantFolder.  Of course, TargetFolder
should do at least as much as ConstantFolder.

> Yes, that looks like a good place. Can I then just make ConstantFolder
> use ConstantFoldInstruction?

It's probably more efficient to directly call ConstantExpr::get if all
operands are constants rather than building an instruction only to have
ConstantFoldInstruction maybe throw it away in favour of a ConstantExpr.

Ciao,

Duncan.



More information about the llvm-commits mailing list