[LLVMdev] LICM/store-aliasing of global loads

Chris Lattner clattner at apple.com
Tue Jul 22 22:18:10 PDT 2008


On Jul 21, 2008, at 3:51 PM, Stefanus Du Toit wrote:
> There seem to be two major ways to expose this to the optimization
> passes and code gen:
> - build a custom alias analysis pass that indicates that these loads
> never alias with any stores in a given function
> - declare these globals as external constants within the module

Since the second has already been examined down-thread, I thought I'd  
talk about the first one.

Instead of implementing a whole new alias analysis, you can build on  
the lib/Analysis/LibCallAliasAnalysis.cpp/LibCallSemantics.cpp stuff.   
This provides a slightly higher level API to define that "objects"  
exist (with custom predicates to determine whether a pointer provably  
points to the 'object') and then define their relations to standard  
functions that can't be marked readnone.

This is mostly useful for things like libm calls, which don't modify  
anything except errno, and errno has a very weird and target-specific  
description.  If your language has similar things, it could be useful  
for that.

-Chris



More information about the llvm-dev mailing list