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

Török Edwin edwintorok at gmail.com
Sun Jan 18 03:31:43 PST 2009

[I've been very busy the last weeks, and I only got time to update the
patch today. I hope I'm not too late with this patch before the freeze]

On 2009-01-05 21:27, Török Edwin wrote:
> 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.

I've put SimplifyBinOp/FindBinOp into VMCore/ConstantFold.cpp, because
if I put it into Support/ConstantFolder.cpp, or
I get circular dependencies between VMCore <-> Support, or VMCore <->
because VMCore instantiates an IRBuilder<>.

New version of my patch attached, I hope this is the final one and I am
allowed to commit it :)

Changes since last version:
* s/findBinOp/FindBinOp
* moved SimplifyBinOp/FindBinOp to VMCore/ConstantFold.cpp
* moved CreateNeg/CreateNot FindBinOp out of ConstantFolder, into IRBuilder
* put { according to LLVM style
* removed comment about preserving div#0

>> 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,


>> 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.

I think I got it right this time.

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: simplifier8.patch
Type: text/x-diff
Size: 22095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090118/be7c52d1/attachment.patch>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: interdiff.txt
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090118/be7c52d1/attachment.txt>

More information about the llvm-commits mailing list