[llvm-commits] [llvm-gcc-4.2] r73439 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Dan Gohman
gohman at apple.com
Tue Jun 16 10:23:50 PDT 2009
On Jun 15, 2009, at 11:26 PM, Duncan Sands wrote:
> Hi Dan,
>
>
>> @@ -3089,6 +3104,8 @@
>>
>> Value *TreeToLLVM::EmitNEGATE_EXPR(tree exp, const MemRef *DestLoc) {
>>
>> if (!DestLoc) {
>>
>> Value *V = Emit(TREE_OPERAND(exp, 0), 0);
>>
>> + if (V->getType()->isFPOrFPVector())
>>
>> + return Builder.CreateFNeg(V);
>>
>> if (!isa<PointerType>(V->getType()))
>>
>> return Builder.CreateNeg(V);
>>
>
> you could also add a CreateAnyNeg builder method that dispatches
> to CreateFNeg/CreateNeg appropriately (and likewise for other
> operations) to handle this kind of thing. Not sure if this is
> really a good idea, but it did strike me that other language
> front-ends might find this helpful.
I wouldn't object if someone wanted to add such utility routines
to IRBuilder.
Dan
More information about the llvm-commits
mailing list