[LLVMdev] Hoisting constant arguments from recursive functions

Chris Lattner clattner at apple.com
Tue Jan 27 23:28:38 PST 2009


On Jan 25, 2009, at 12:21 AM, Jon Harrop wrote:
> My question is: will LLVM optimize this back into a function  
> containing a loop
> that runs inside a single stack frame that contains the constants  
> "a" and "x"
> or should my compiler perform this rewrite itself?

The easiest way to answer this is to write the moral equivalent in C,  
and see if it happens for it.

> Also, would any simple rearrangements help LLVM, such as putting the  
> constant
> function arguments to the back of the argument list?

I don't think that should matter.  If there are cases that LLVM could  
catch but doesn't (either in LLVM IR or in C code), please file a  
bugzilla.

-Chris



More information about the llvm-dev mailing list