[LLVMdev] How to disable simplifying function parameters in llvm-g++

Duncan Sands baldrick at free.fr
Mon Jul 26 23:55:20 PDT 2010


Hi Xiaolong,

> I checked the result spit out by Clang (I have not found good reasons
> to switch to Clang until today :). It turned out that Clang preserves
> more accurate type information than llvm-g++, at least in my test
> cases.Back to the example in our discussion, the compiled function
> prototype is:
>
>    define linkonce_odr void @_ZNSt4listIiSaIiEE9_M_insertESt14_List_iteratorIiERKi(%"class.std::list"* %this, %"struct.std::_List_node_base"* %__position.coerce, i32* %__x) ssp align 2 { ... }
>
> Compared with llvm-g++, the second parameter is of type
> %"struct.std::_List_node_base"*, rather than a plain i64. Note that
> the fact does not impair your argument on the conformance to
> ABI. llvm-g++ may do better, however. :)

since the final assembler is the same, both of these approaches are
correct.  However the code produced by clang is likely to be more
easily optimizable.

Ciao,

Duncan.



More information about the llvm-dev mailing list