[LLVMdev] Improving performance with optimization passes

Chris Lattner clattner at apple.com
Thu Feb 19 14:31:29 PST 2009


On Feb 19, 2009, at 11:44 AM, Jon Harrop 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:
>
>  let zsqr(r, i) = (r*r - i*i, 2*r*i)
>
> My compiler is generating:
>
> define fastcc i32 @zsqr({ double, double }*, { double, double }) {
> entry:
> 	%2 = alloca { double, double }		; <{ double, double }*> [#uses=2]

Jon, make sure you always emit allocas into the entry block of the  
function.  Otherwise mem2reg and SROA won't hack on them.

-Chris




More information about the llvm-dev mailing list