[LLVMdev] 64bit MRV problem: { float, float, float} -> { double, float }

Ralf Karrenberg Chareos at gmx.de
Mon Jan 25 02:44:07 PST 2010


Hey everybody,

I am struggling to get rid of a problem which seems to be related to a
multi-return value optimization:
I generate bitcode for a c++-function with llvm-g++ which is then
linked, transformed and optimized at runtime using LLVM. The function
has quite a few parameters, including structs and struct-pointers with 3
float fields.
The problem is, that I require the function to preserve the number and
type of its arguments, but some optimization on 64bit breaks up some of
the struct parameters (I suppose only those that are just loaded and/or
stored somewhere) and inserts a double and a float.
Same goes for load and store instructions of the same struct-type: in
general it might be a good idea to only do two loads/stores (1 double, 1
float) instead of three (3 float), but I don't want this to happen.

Unfortunately, the optimization seems to happen in the frontend already
(llvm-gcc/gcc/config/i386/llvm-i386.cpp and/or
llvm-gcc/gcc/llvm-convert.cpp) - can I do something to prevent this?
One thing that works is generating code for 32bit (-m32), but this
obviously causes other problems.


Best regards,
Ralf




More information about the llvm-dev mailing list