Kenneth Adam Miller via llvm-dev
2018-May-22 16:50 UTC
[llvm-dev] CFLAndersAliasAnalysis print implementation
Hello all,
I'm having trouble getting this analysis to print out it's graph of
aliases. I am processing an example C file into llvm ir, like this:
int main(void) {
int x=1, y=2, z=3;
int *p;
int **p1, **p2;
if (x==z) { //0x100000f40
p=&x;
p1=&p;
x*=2;
*p1+=z;
}
}
clang -S -emit-llvm example.c -o example.ll
Then, I am trying to run the Andersen alias analysis on it:
opt -analyze --cfl-anders-aa -aa example.ll
I wrote a new print function for the anders alias analysis, and the print
function parameter Module *M and the Result calculated each indicate that
there are no aliases. I'm certain I'm missing something, but I don't
know
what. To be absolutely clear, a Result is calculated of type:
std::unique_ptr<CFLAndersAAResult> Result;
And CFLAndersAAResult contains member fields:
DenseMap<const Function *, Optional<FunctionInfo>> Cache;
std::forward_list<cflaa::FunctionHandle<CFLAndersAAResult>>
Handles;
The DenseMap Cache is empty, and so is Handles.
I can do -print-alias-sets, and that prints something, but I don't think
it's the result of the Andersen analysis. Because when I do commands
with --cfl-anders-aa
taken out, I still get the same alias sets.
Can anybody help me get the Andersen alias results?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180522/2bc245ba/attachment.html>
Kenneth Adam Miller via llvm-dev
2018-May-23 22:35 UTC
[llvm-dev] CFLAndersAliasAnalysis print implementation
Ok, the command necessary to get past this is: opt ./example.ll -disable-basicaa -cfl-anders-aa -aa-eval -disable-output -print-alias-sets It was non-intuitive, because I thought turning on cfl-anders-aa would also enable printing the alias sets automatically. It also helps to add this flag: -mem2reg On Tue, May 22, 2018 at 12:50 PM, Kenneth Adam Miller < kennethadammiller at gmail.com> wrote:> Hello all, > > I'm having trouble getting this analysis to print out it's graph of > aliases. I am processing an example C file into llvm ir, like this: > > int main(void) { > int x=1, y=2, z=3; > int *p; > int **p1, **p2; > if (x==z) { //0x100000f40 > p=&x; > p1=&p; > x*=2; > *p1+=z; > } > } > > clang -S -emit-llvm example.c -o example.ll > > Then, I am trying to run the Andersen alias analysis on it: > > opt -analyze --cfl-anders-aa -aa example.ll > > I wrote a new print function for the anders alias analysis, and the print > function parameter Module *M and the Result calculated each indicate that > there are no aliases. I'm certain I'm missing something, but I don't know > what. To be absolutely clear, a Result is calculated of type: > > std::unique_ptr<CFLAndersAAResult> Result; > > And CFLAndersAAResult contains member fields: > > DenseMap<const Function *, Optional<FunctionInfo>> Cache; > > std::forward_list<cflaa::FunctionHandle<CFLAndersAAResult>> Handles; > > The DenseMap Cache is empty, and so is Handles. > > I can do -print-alias-sets, and that prints something, but I don't think > it's the result of the Andersen analysis. Because when I do commands with --cfl-anders-aa > taken out, I still get the same alias sets. > > Can anybody help me get the Andersen alias results? >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180523/2d3e0ddb/attachment.html>
Seemingly Similar Threads
- [LLVMdev] question about enabling cfl-aa and collecting a57 numbers
- [LLVMdev] question about enabling cfl-aa and collecting a57 numbers
- [LLVMdev] question about enabling cfl-aa and collecting a57 numbers
- PartialAlias: different start addresses
- PartialAlias: different start addresses