[llvm-bugs] [Bug 33567] New: DependenceAnalysis ignores base pointers and only looks at array indeces

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 23 06:39:23 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33567

            Bug ID: 33567
           Summary: DependenceAnalysis ignores base pointers and only
                    looks at array indeces
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: stanislav.manilov at gmail.com
                CC: llvm-bugs at lists.llvm.org

Consider the following two examples:

void example_A(int *A, unsigned n) {
  for (unsigned i = 0; i < n; ++i) {
    A[i] = A[i + 1];
  }
}

void example_B(int *A, unsigned n) {
  int *B = A + 1;
  for (unsigned i = 0; i < n; ++i) {
    A[i] = B[i];
  }
}

I expect DependenceAnalysis to give me the same result from both examples,
ideally "anti [1|<]" if I understand the notation correctly. Explicitly, I
expect an anti dependence of distance 1, since on iteration i+1 the loop reads
the memory location written on iteration i.

Quoting Philip (philip.pfaffe at gmail.com):

In the first example, I get an "anti [*|<]" result. DA doesn't look through
zext expressions, so it needs to overapproximate.

In the second example I get a "consistent anti [0|<]" result, which is wrong.
The cause of this bug is that DA falsely ignores the base pointer, and only
looks at the indices.

End of quote.

I have verified this and get the same results on LLVM 3.9.1 and LLVM trunk
(f066646d).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170623/34a2a1a1/attachment.html>


More information about the llvm-bugs mailing list