[llvm] r234283 - [LoopAccesses] New API to query if memchecks are necessary after partitioning

Adam Nemet anemet at apple.com
Mon Apr 6 20:35:26 PDT 2015


Author: anemet
Date: Mon Apr  6 22:35:26 2015
New Revision: 234283

URL: http://llvm.org/viewvc/llvm-project?rev=234283&view=rev
Log:
[LoopAccesses] New API to query if memchecks are necessary after partitioning

This is used by Loop Distribution.

Modified:
    llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
    llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp

Modified: llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h?rev=234283&r1=234282&r2=234283&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h Mon Apr  6 22:35:26 2015
@@ -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

Modified: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp?rev=234283&r1=234282&r2=234283&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp Mon Apr  6 22:35:26 2015
@@ -177,6 +177,17 @@ void LoopAccessInfo::RuntimePointerCheck
       }
 }
 
+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.
 ///





More information about the llvm-commits mailing list