[LLVMdev] Non-immutable alias analysis

Duncan Sands baldrick at free.fr
Wed Dec 5 09:48:45 PST 2012

Hi Ohad,

> I wrote a module pass that uses Alias Analysis.
> For this reason I added AU.addRequired<AliasAnalysis>() to function
> getAnalysisUsage and used getAnalysis<AliasAnalysis>() in my pass.
> I tried a few types of alias analyses and I discovered that only alias analyses
> which are ImmutablePasses are returned using getAnalysis<AliasAnalysis>().
> Moreover, when I added both ImmutablePass and FunctionPass,
> getAnalysis<AliasAnalysis>() returned the ImmutablePass while the FunctionPass
> did not even appear in the AA chain ( I assume it is because building the chain
> uses getAnalysis as well).
> Does this feature should be supported?

except for immutable alias analyses you have to schedule the alias analysis pass
immediately before your pass otherwise it won't be used.  This is an old problem
and I'm sure there are some bug reports about it, maybe PR7720?

Ciao, Duncan.

More information about the llvm-dev mailing list