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

Török Edwin edwintorok at gmail.com
Mon Jan 5 11:27:07 PST 2009


On 2009-01-05 21:06, Chris Lattner wrote:
> On Jan 5, 2009, at 1:25 AM, Török Edwin wrote:
>   
>> I added back the Constant* functions in ConstantFolder/TargetFolder,
>> since llvm-gcc is using them (called with constant* params, expecting
>> constant* return).
>>     
>
> Hi Edwin,
>
> Please don't put the large SimplifyBinOp/findBinOp functions inline  
> into ConstantFolder.h.
>   

Hi Chris,

What .cpp file should it live in?
I can't find anything suitable in lib/Support/, and I wouldn't put it
into Analysis, since IRBuilder is in Support.
Should I create a ConstantFolder.cpp?

> Also, I think it is somewhat strange to call ConstantFolder::CreateNot  
> with non-constant operands.  Should this functionality be moved out of  
> the ConstantFolder class into some new place?
>   

At the moment it is called from IRBuilder.h only, I could put the
CreateNot/CreateNeg functionality into IRBuilder,
and remove those CreateNot/CreateNeg taking non-constant operands from
the folder, since all it does is call findBinOp if reuseOps is true.

> finally, please follow the standard convention of putting the '{' on  
> the previous line instead of on a new one.
>   

I'll fix, findBinOp/getReuse has it in the wrong place.
It seems I am automatically putting the { after the function prototype
without even noticing.

Best regards,
--Edwin



More information about the llvm-commits mailing list