[llvm] r252016 - [LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 15:50:03 PST 2015


Author: anemet
Date: Tue Nov  3 17:50:03 2015
New Revision: 252016

URL: http://llvm.org/viewvc/llvm-project?rev=252016&view=rev
Log:
[LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC

Summary: Will be used by the LoopLoadElimination pass.

Reviewers: hfinkel

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13258

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=252016&r1=252015&r2=252016&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h Tue Nov  3 17:50:03 2015
@@ -179,7 +179,12 @@ public:
     /// \brief Dependence types that don't prevent vectorization.
     static bool isSafeForVectorization(DepType Type);
 
-    /// \brief Lexically backward dependence types.
+    /// \brief Lexically forward dependence.
+    bool isForward() const;
+    /// \brief Lexically backward dependence.
+    bool isBackward() const;
+
+    /// \brief May be a lexically backward dependence type (includes Unknown).
     bool isPossiblyBackward() const;
 
     /// \brief Print the dependence.  \p Instr is used to map the instruction

Modified: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp?rev=252016&r1=252015&r2=252016&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp Tue Nov  3 17:50:03 2015
@@ -910,14 +910,14 @@ bool MemoryDepChecker::Dependence::isSaf
   llvm_unreachable("unexpected DepType!");
 }
 
-bool MemoryDepChecker::Dependence::isPossiblyBackward() const {
+bool MemoryDepChecker::Dependence::isBackward() const {
   switch (Type) {
   case NoDep:
   case Forward:
   case ForwardButPreventsForwarding:
+  case Unknown:
     return false;
 
-  case Unknown:
   case BackwardVectorizable:
   case Backward:
   case BackwardVectorizableButPreventsForwarding:
@@ -925,6 +925,26 @@ bool MemoryDepChecker::Dependence::isPos
   }
   llvm_unreachable("unexpected DepType!");
 }
+
+bool MemoryDepChecker::Dependence::isPossiblyBackward() const {
+  return isBackward() || Type == Unknown;
+}
+
+bool MemoryDepChecker::Dependence::isForward() const {
+  switch (Type) {
+  case Forward:
+  case ForwardButPreventsForwarding:
+    return true;
+
+  case NoDep:
+  case Unknown:
+  case BackwardVectorizable:
+  case Backward:
+  case BackwardVectorizableButPreventsForwarding:
+    return false;
+  }
+  llvm_unreachable("unexpected DepType!");
+}
 
 bool MemoryDepChecker::couldPreventStoreLoadForward(unsigned Distance,
                                                     unsigned TypeByteSize) {




More information about the llvm-commits mailing list