[PATCH] [LoopAccesses 2/3] Allow querying of interesting dependences

Adam Nemet anemet at apple.com
Sun Mar 8 19:18:17 PDT 2015


================
Comment at: include/llvm/Analysis/LoopAccessAnalysis.h:261
@@ +260,3 @@
+  /// RecordInterestingDependences is true.
+  SmallVector<Dependence, 1> InterestingDependences;
+
----------------
hfinkel wrote:
> Do you really feel that, most of time time, this holds only 1 entry? Given that `Dependence` is only three integers, I'd recommend something larger (4, 8, 16)?
No you're right, I don't know why I picked 1.  Thanks for noticing.

================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:53
@@ +52,3 @@
+/// \brief We collect interesting dependences up to this threshold.
+const unsigned MaxInterestingDependence = 100;
+
----------------
hfinkel wrote:
> Please make this a command-line parameter.
Sure thing.

================
Comment at: lib/Analysis/LoopAccessAnalysis.cpp:798
@@ +797,3 @@
+              std::swap(A, B);
+
+            Dependence::DepType Type =
----------------
hfinkel wrote:
> I could be mis-remembering how this loop works, but it seems like we're doing twice as much work here as necessary. If there is a forward dependency between A and B, then there's a backward dependence between B and A? If the dependence of A and B is unknown, then the dependence of B and A is unknown. Could we take advantage of that here?
> 
I don't think that is how this this code works.

*AI and *OI are accesses using the same underlying pointers.  We do make sure we visit each pair only once (OI started from std::next(AI).

Now that said, you're right that if we have *multiple* instructions using either of the accesses *AI or *OI we invoke isDependent multiple times and will get the exact same result -- inDependent only uses the indices (*I1 and *I2) for debug output.  So all this can probably be simplified into isDepedent only taking *AI and *OI.

I can attempt to make this simplification in a follow-up.  Do you agree?

http://reviews.llvm.org/D8114

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list