[LLVMdev] Improving performance with optimization passes
Nick Lewycky
nicholas at mxc.ca
Fri Feb 20 00:30:59 PST 2009
Anton Korobeynikov wrote:
>>
>> On Thursday 19 February 2009 19:00:14 Jon Harrop wrote:
>>> I'm toying with benchmarks on my HLVM and am unable to get any
>>> performance
>>> improvement from optimization passes...
>>
>> I just disassembled some of the IR before and after optimization. This
>> example
>> function squares a complex number:
> Something is definitely wrong with the way you're using optimization passes.
>
>> The ideal result is probably:
> It is indeed so:
>
> ./opt -std-compile-opts test.bc | ./llvm-dis
> ; ModuleID = '<stdin>'
>
> define fastcc i32 @zsqr({ double, double }* nocapture, { double, double
> }) nounwind {
> entry:
> %2 = extractvalue { double, double } %1, 0 ; <double> [#uses=1]
> %3 = extractvalue { double, double } %1, 0 ; <double> [#uses=1]
I've filed llvm.org/PR3623 to track the fact that these aren't merged.
Nick
> %4 = mul double %2, %3 ; <double> [#uses=1]
> %5 = extractvalue { double, double } %1, 1 ; <double> [#uses=1]
> %6 = extractvalue { double, double } %1, 1 ; <double> [#uses=1]
> %7 = mul double %5, %6 ; <double> [#uses=1]
> %8 = sub double %4, %7 ; <double> [#uses=1]
> %9 = extractvalue { double, double } %1, 0 ; <double> [#uses=1]
> %10 = mul double %9, 2.000000e+00 ; <double> [#uses=1]
> %11 = extractvalue { double, double } %1, 1 ; <double> [#uses=1]
> %12 = mul double %10, %11 ; <double> [#uses=1]
> %insert = insertvalue { double, double } undef, double %8, 0 ; <{
> double, double }> [#uses=1]
> %insert2 = insertvalue { double, double } %insert, double %12, 1 ; <{
> double, double }> [#uses=1]
> store { double, double } %insert2, { double, double }* %0
> ret i32 0
> }
>
> ---
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list