i need a sample-code, for which the llvm alias-analysis finds a must-aliases.
I have tried codes like followings. In all cases, i see just may-aliases when i use “opt -aa-eval -print-all-alias-modref-info foo.bc”:
Regards
Raad
1 ==========================================
void foo() {
int i = 2;
int& r = i;
}
2 ===========================================
void foo(){
int gi;
int *gip1 = &gi;
int *gip2 = &gi;
}
3 ==========================================
void foo (double * fa){
int fi, fj;
fi = 0;
fj = 2;
if (! fa)
fj = fj + 4;
fa[fi] = fa[fi + fj];
}
i need a sample-code, for which the llvm alias-analysis finds a *must-aliases*.
I have tried codes like followings. In all cases, i see just *may-aliases* when i use "opt -aa-eval -print-all-alias-modref-info foo.bc":
Your examples are all .c files. What did your .ll look like? Here's the problem:
Obviously %r and %i don't alias: they're two separate heap allocations. What you really want to do is run through some optimizations like mem2reg and friends. But on that same example, it'll produce this:
The must-alias result is really hard to produce from a .c file because it inherently means that one pointer is *exactly* equal to the other in the sense that you could replace one with the other. One of them would wind up being deleted.
You can cook up a .ll example easily enough, or I suppose you could fiddle with .c examples piped through select optimizations to produce an example that works for you.