[LLVMdev] RFC: PerfGuide for frontend authors

Philip Reames listmail at philipreames.com
Mon Feb 23 16:46:37 PST 2015


I'd like to propose that we create a new Performance Guide document.  
The target of this document will be frontend authors, not necessarily 
LLVM contributors.  The content will be a collection of items a frontend 
author might want to know about how to generate LLVM IR which will 
optimize well.

Some ideas on topics that might be worthwhile:
- Prefer sext over zext when value is known to be positive in the 
language (e.g. range checked index on a GEP)
- Avoid loading and storing first class aggregates (i.e. they're not 
well supported in the optimizer)
- Mark invariant locations - i.e. link to !invariant.load and TBAA 
constant flags
- Use globals not inttoptr for runtime structures - this gives you 
dereferenceability information
- Use function attributes where possible (nonnull, deref, etc..)
- Be ware of ordered and atomic memory operations (not well optimized), 
depending on source language, might be faster to use fences.
- Range checks - make sure you test with the IRCE pass

If folks are happy with the idea of having such a document, I volunteer 
to create version 0.1 with one or two items.  After that, we can add to 
it as folks encounter ideas.  The initial content will be fairly 
minimal, I just want a link I can send to folks in reviews to record 
comments made.  :)

Philip



More information about the llvm-dev mailing list