[llvm-dev] Incorrect behavior in the LLVM dependence analyzer

Ejjeh, Adel via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 23 15:21:11 PDT 2020

Hi all,

I am trying to use the dependence analyzer in a pass that I am writing and I was surprised to see an incorrect behavior when I try to query DependenceInfo for dependences between instructions. Specifically, if the two instructions are loads/stores accessing an array in a loop, the depend() method would return a dependence regardless of the order of instructions specified. (i.e. if the two instructions where L1 and S1, both depend(L1, S1) and depend(S1,L1) would return a dependence), even though only one of the two dependences is valid when the chronological order of the instructions is considered. To illustrate consider this example:

for(int i = 0; i < n; i++) {
S0:   A[i] = …;
S1:   … = A[i+1];

In the example, there is an antidependence between S1 and S0 with distance 1. However, when querying DependenceInfo it also returns a flow dependence from S0 to S1. Is this the expected behavior of DependenceInfo or Is it a known problem? If it is the expected behavior, is there a way to check if the dependence you are getting back is a correct one or not? Does anyone have any ideas about possible workarounds or solutions?
- Adel

Adel Ejjeh
PhD Candidate – Computer Science
University of Illinois at Urbana Champaign
201 N Goodwin Ave, Urbana, IL 61801
aejjeh at illinois.edu<mailto:aejjeh at illinois.edu> | adel.ejjeh at gmail.com<mailto:adel.ejjeh at gmail.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200423/8ecca6f0/attachment.html>

More information about the llvm-dev mailing list