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

Duncan Sands baldrick at free.fr
Mon Dec 29 03:07:59 PST 2008


Hi Edwin,

> The attached patch adds another template parameter (that defaults to a
> no-op implementation) to simplify BinOps where one operand is constant.

I think this approach makes a fairly artificial distinction between
constant folding when all operands are constant and constant folding
when some operands are constant.  How about only having a simplifier:
it would do what the folder does now if all operands are constant,
and otherwise do the simplifications that your patch added.  For that
matter, how about adding your simplifications to ConstantFoldInstruction,
and have that do the work for the not-all-constant case.

Ciao,

Duncan.



More information about the llvm-commits mailing list