[LLVMdev] Bounds checking

Jon Harrop jon at ffconsultancy.com
Sat Dec 1 08:12:09 PST 2007

On Saturday 01 December 2007 16:07, Gordon Henriksen wrote:
> ...
> Since you're working with a functional language, you may be able to
> know that 'arr' itself and 'arr.length' are both immutable (based on
> properties of your language/object model). If so, use only a single
> SSA value for each rather than 'load'ing them over again at each use.
> This eliminates the dependency on alias analysis (at the cost of
> increased register pressure). With that out of the way, it becomes a
> matter of building a pass pipeline which either hoists or eliminates
> the checks. opt -mem2reg -gvn -predsimplify -licm -dce -simplifycfg
> may be a starting point for elimination. Any of the passes in lib/
> Transforms/Scalar which include the string 'SCEV' may be helpful for
> hoisting.

Brilliant, thanks. I'm extremely busy ATM but my plan is to implement a 
compiler for a pure first-order language and use it to benchmark various 
different approaches. I might even reuse my ray tracer benchmark for 
this... :-)

Dr Jon D Harrop, Flying Frog Consultancy Ltd.

More information about the llvm-dev mailing list