From ad8a6b66d9c1f9286cecf1de9cf07f38c663ba4e Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Tue, 7 Apr 2015 03:35:26 +0000 Subject: [PATCH] [LoopAccesses] New API to query if memchecks are necessary after partitioning 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 | 4 ++++ lib/Analysis/LoopAccessAnalysis.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/llvm/Analysis/LoopAccessAnalysis.h b/include/llvm/Analysis/LoopAccessAnalysis.h index 0a9dc07102e..19b400900c5 100644 --- a/include/llvm/Analysis/LoopAccessAnalysis.h +++ b/include/llvm/Analysis/LoopAccessAnalysis.h @@ -339,6 +339,10 @@ public: bool needsChecking(unsigned I, unsigned J, const SmallVectorImpl *PtrPartition) const; + /// \brief Return true if any pointer requires run-time checking according + /// to needsChecking. + bool needsAnyChecking(const SmallVectorImpl *PtrPartition) const; + /// \brief Print the list run-time memory checks necessary. /// /// If \p PtrPartition is set, it contains the partition number for diff --git a/lib/Analysis/LoopAccessAnalysis.cpp b/lib/Analysis/LoopAccessAnalysis.cpp index 159efff1a70..ae561d7a26a 100644 --- a/lib/Analysis/LoopAccessAnalysis.cpp +++ b/lib/Analysis/LoopAccessAnalysis.cpp @@ -177,6 +177,17 @@ void LoopAccessInfo::RuntimePointerCheck::print( } } +bool LoopAccessInfo::RuntimePointerCheck::needsAnyChecking( + const SmallVectorImpl *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. ///