__attribute__((noinline)) void foo(int i,int j)
{
printf("%d %d",i,j);
}
int main()
{
int j;
int k;
scanf("%d%d",&j,&k);
j+=10;
k-=3;
//func call to force the stores
foo(j,k);
//func call to force the loads
printf("%d %d",j,k);
}
> On Mar 8, 2021, at 03:46, sushant gokhale via llvm-dev <llvm...@lists.llvm.org> wrote:
>
> Hi,
>
> I want to track StoreInst that affect loadInst/CallInst.
>
> e.g %1 = alloc i32
> store 10,%1
> foo(%1) -------> %1 should take the value 10 (defined by store ins)
>
> I tried to use MemSSA for this but for situations I can't find these correct dependencies possibly due to insufficient Alias information
MemorySSA should be helpful here. One thing to note is that MemorySSA is not completely optimized at construction, but it guarantees that all potentially clobbering instructions are in the memory def-use chain.
It is up the the so-called walkers to skip over non-aliasing accesses. Please take a look at https://llvm.org/doxygen/classllvm_1_1MemorySSAWalker.html . They provide getClobberingMemoryAccess, which skip non-aliasing instructions, depending on the walker implementation. You can use MemorySSA::getWalker to get the default walker. If that doesn’t do what you want, you probably need to define your own walker. At last LLVM Developers meeting, there was a talk covering MemorySSA: https://www.youtube.com/watch?v=1e5y6WDbXCQ
Cheers,
Florian
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev