Bodhisatwa via llvm-dev
2019-Jun-14 16:50 UTC
[llvm-dev] Using isConfused() method for LLVM Dependence Analysis
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? -- Bodhisatwa
David Green via llvm-dev
2019-Jun-15 08:30 UTC
[llvm-dev] Using isConfused() method for LLVM Dependence Analysis
Hello. Are a, b and c globals in this example? How are you running this? I believe depends() will return a pointer to a Dependence (technically a unique pointer to a Dependence), which should be nullptr if there are no dependencies, such as these cases that should be no-alias. Confused dependencies are expected to come from cases where we don't know the relationship between pointers. Such as this where we don't know the relationship between a and b: void test(int * a, int * b, int n) { for (int i = 0; i < n; i++) { a[i] = 1; b[i] = 2; } } Dave From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Bodhisatwa via llvm-dev <llvm-dev at lists.llvm.org> Sent: 14 June 2019 17:50 To: llvm-dev at lists.llvm.org Subject: [llvm-dev] Using isConfused() method for LLVM Dependence Analysis 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? -- Bodhisatwa _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev