<div dir="ltr"><div><div><div><div>Hi,<br><br>I'm attempting to do some alias analysis & other memory inspection. I've written a pointless AliasAnalysis pass (that says everything must alias) to attempt to verify that my pass is getting picked up & run by opt.<br>
<br></div>I run opt with: opt -load ~/Applications/llvm/lib/MustAA.so -must-aa -aa-eval -debug < trace0.ll<br><br></div>I see my pass being initialized, but never being called (I see only may alias results). <br><br></div>
Any ideas as to what to do to debug this? Or what I'm missing? I've read through <a href="http://llvm.org/docs/AliasAnalysis.html">http://llvm.org/docs/AliasAnalysis.html</a> and don't see anything that I'm missing.<br>
<br></div>Thanks,<br>Matthew<br><br>P.S. Here's the full source code of my pass:<br><br>#define DEBUG_TYPE "must-aa"<br>#include "llvm/Pass.h"<br>#include "llvm/Analysis/AliasAnalysis.h"<br>
#include "llvm/Support/raw_ostream.h"<br>#include "llvm/Support/Debug.h"<br>using namespace llvm;<br><br>namespace {<br>struct EverythingMustAlias : public ImmutablePass, public AliasAnalysis {<br> static char ID;<br>
EverythingMustAlias() : ImmutablePass(ID) {}<br><br> virtual void initializePass() {<br> DEBUG(dbgs() << "Initializing everything-must-alias\n");<br> InitializeAliasAnalysis(this);<br> }<br><br> virtual void getAnalysisUsage(AnalysisUsage &AU) const {<br>
AliasAnalysis::getAnalysisUsage(AU);<br> AU.setPreservesAll();<br> }<br><br> virtual AliasResult alias(const Location &LocA, const Location &LocB) {<br> DEBUG(dbgs() << "Everything must alias!\n");<br>
return AliasAnalysis::MustAlias;<br> }<br>};<br>}<br><br>namespace llvm {<br>void initializeEverythingMustAliasPass(PassRegistry &Registry);<br>}<br><br>char EverythingMustAlias::ID = 0;<br>static RegisterPass<EverythingMustAlias> A("must-aa", "Everything must alias");<br>
INITIALIZE_AG_PASS(EverythingMustAlias, AliasAnalysis, "must-aa",<br> "Everything must alias", false, true, false)<br><br></div>