[PATCH] D13258: [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:52:32 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL252016: [LAA] LLE 5/6: Add predicate functions Dependence::isForward/isBackward, NFC (authored by anemet).

Changed prior to commit:
  http://reviews.llvm.org/D13258?vs=36002&id=39130#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13258

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

Index: llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
+++ llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -179,7 +179,12 @@
     /// \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
Index: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
===================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
@@ -910,22 +910,42 @@
   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:
     return true;
   }
   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) {
   // If loads occur at a distance that is not a multiple of a feasible vector


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13258.39130.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151103/7707b267/attachment.bin>


More information about the llvm-commits mailing list