[llvm-commits] [llvm-gcc-4.2] r73439 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Mon Jun 15 23:26:21 PDT 2009


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.

Ciao,

Duncan.



More information about the llvm-commits mailing list