[LLVMdev] Running an Alias Analysis without opt

Julien Henry julienhenry23 at gmail.com
Fri Jan 4 03:56:43 PST 2013


Hi all,

I'm working on an Pass that needs results from an alias analysis. More 
precisely, I'd like to use the AliasSetTracker class.
I added AU.addRequired<AliasAnalysis>(); at the right place.

I know the defaut AliasAnalysis does nothing and I currently get 
everything as "may" aliases. My tool is standalone and does not use opt, 
so I can't simply do something like opt -globalsmodref-aa -my_pass .
I've seen somewhere that I had to add the following code (for instance) 
before running my pass :

PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeTypeBasedAliasAnalysisPass(Registry);
...
Passes.add(createTypeBasedAliasAnalysisPass());
Passes.add(MyPass);
...
Passes.run(*M);

but this doesn't solve the problem, I still get everything as "may" 
aliases :

AliasSet[0xb971940, 6] may alias, Mod/Ref   Pointers: (double* %x, 8), 
(i32* %k, 4), (double* %arrayidx, 8), (double* %arrayidx1, 8), (i32* 
@global, 4), (i32* getelementptr inbounds (i32* @global, i32 10), 4)

What am I doing wrong ?

Julien



More information about the llvm-dev mailing list