[llvm-dev] Using isConfused() method for LLVM Dependence Analysis

Chatterjee, Bodhisatwa via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 14 09:24:41 PDT 2019


Hi,


I am trying to find out instances of confused dependencies in my program. According to LLVM's doxygen page, 'confused dependencies' are detected by function isConfused() - Returns true if this dependence is confused (the compiler understands nothing and makes worst-case assumptions) (http://llvm.org/doxygen/classllvm_1_1Dependence.html#a5c65e22ef4b0368ab040d1bd4ead382d)


For the following code snippet:

  for (int i = 0; i < 10; i++)
   {
       a = 1;
       for (int j = 0; j < 9; j++)
          {
             b = 2;
             for (int k = 0; k < 8; k++)
                {
                     c = 3;
                }
          }
   }
We are constructing dependencies between the corresponding IR of the above code and checking whether it is confused or not:


  store i32 1, i32* @a, align 4
  store i32 2, i32* @b, align 4
Confused Dependence or Not: 1

Since the variables 'a' and 'b' are in different memory locations, why is LLVM's isConfused method gives us True?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190614/9c7a9221/attachment.html>


More information about the llvm-dev mailing list