[LoopAccesses] New API to query if memchecks are necessary after partitioning
authorAdam Nemet <anemet@apple.com>
Tue, 7 Apr 2015 03:35:26 +0000 (03:35 +0000)
committerAdam Nemet <anemet@apple.com>
Tue, 7 Apr 2015 03:35:26 +0000 (03:35 +0000)
This is used by Loop Distribution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234283 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopAccessAnalysis.h
lib/Analysis/LoopAccessAnalysis.cpp

index 0a9dc07102ef9a1c6eebae2c772ddd90ce5a633c..19b400900c561e9effb28077eac1a9cddab35d93 100644 (file)
@@ -339,6 +339,10 @@ public:
     bool needsChecking(unsigned I, unsigned J,
                        const SmallVectorImpl<int> *PtrPartition) const;
 
+    /// \brief Return true if any pointer requires run-time checking according
+    /// to needsChecking.
+    bool needsAnyChecking(const SmallVectorImpl<int> *PtrPartition) const;
+
     /// \brief Print the list run-time memory checks necessary.
     ///
     /// If \p PtrPartition is set, it contains the partition number for
index 159efff1a7094f3eed22e681fdf63e8d3530a5f9..ae561d7a26a160c2960ffa7cf4fc8b4349e81634 100644 (file)
@@ -177,6 +177,17 @@ void LoopAccessInfo::RuntimePointerCheck::print(
       }
 }
 
+bool LoopAccessInfo::RuntimePointerCheck::needsAnyChecking(
+    const SmallVectorImpl<int> *PtrPartition) const {
+  unsigned NumPointers = Pointers.size();
+
+  for (unsigned I = 0; I < NumPointers; ++I)
+    for (unsigned J = I + 1; J < NumPointers; ++J)
+      if (needsChecking(I, J, PtrPartition))
+        return true;
+  return false;
+}
+
 namespace {
 /// \brief Analyses memory accesses in a loop.
 ///