From 51870d16e4663a79cf8ebf6b2d860c2695b3d091 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. llvm-svn: 234283 --- llvm/include/llvm/Analysis/LoopAccessAnalysis.h | 4 ++++ llvm/lib/Analysis/LoopAccessAnalysis.cpp | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h index 0a9dc071..19b4009 100644 --- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h +++ b/llvm/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/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 159efff..ae561d7 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/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. /// -- 2.7.4