[LLVMdev] Improving performance with optimization passes

Anton Korobeynikov anton at korobeynikov.info
Thu Feb 19 12:02:10 PST 2009


>
> 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]
	%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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090219/1d985257/attachment.html>


More information about the llvm-dev mailing list