Hi,
I'm trying to use polly with llvm, my idea was to use the result of the analysis with polly on one of my pass.
After some problems with the library I managed to write an empty pass with the polly lib included (I had to add some line in the cmakelist file of the polly project).
Now I want to do something like
this, in particular I want to write a pass that identify all the loop carried dependence and prints the instruction associate to it and their distance.
I started with this piece of code just to get more comfortable using the library:
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.addRequiredTransitive<DependenceInfoWrapperPass>();
AU.addRequired<LoopInfoWrapperPass>();
AU.addRequiredTransitive<ScopInfoWrapperPass>();
AU.setPreservesAll();
}
bool runOnFunction(Function &F) override {
DependenceInfoWrapperPass *DI = &getAnalysis<DependenceInfoWrapperPass>();
ScopInfo *SI = getAnalysis<ScopInfoWrapperPass>().getSI();
for(ScopInfo::iterator i = SI->begin(), e = SI->end(); i!=e; i++){
errs() << "ok\n";
}
}
I run it on my code, and I don't see anything in output, but I was expecting at least one "ok".
I'm sure that I have the scop in my c program since I only wrote one loop like this:
for(int i = 1; i < 10; i++){
a[i]+=a[i-1];
}
I've double checked also by following
this and those commands prints all the information that I expect.
Do you know why it doesn't print anything or do you have a short working example that prints all the dependencies and distances in a loop?
PS a simple tutorial on the site
like the one on llvm would be great for new comers, I'm still not so sure about what I did. It works, but it doesn't feel right.