[llvm-branch-commits] [llvm] 43d1c7a - [Hexagon] Fix build: move template specialization into namespace scope

Krzysztof Parzyszek via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 9 15:45:09 PST 2020


Author: Krzysztof Parzyszek
Date: 2020-12-09T17:40:15-06:00
New Revision: 43d1c7a56453f200ea1f91783b0af9837d48afe7

URL: https://github.com/llvm/llvm-project/commit/43d1c7a56453f200ea1f91783b0af9837d48afe7
DIFF: https://github.com/llvm/llvm-project/commit/43d1c7a56453f200ea1f91783b0af9837d48afe7.diff

LOG: [Hexagon] Fix build: move template specialization into namespace scope

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
index 3ca3e9e5dc39..d930824c0194 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -212,19 +212,6 @@ class AlignVectors {
     const_iterator end() const { return Blocks.end(); }
   };
 
-  template <typename T> static T *getIfUnordered(T *MaybeT) {
-    return MaybeT && MaybeT->isUnordered() ? MaybeT : nullptr;
-  }
-  template <typename T> static T *isCandidate(Instruction *In) {
-    return dyn_cast<T>(In);
-  }
-  template <> LoadInst *isCandidate<LoadInst>(Instruction *In) {
-    return getIfUnordered(dyn_cast<LoadInst>(In));
-  }
-  template <> StoreInst *isCandidate<StoreInst>(Instruction *In) {
-    return getIfUnordered(dyn_cast<StoreInst>(In));
-  }
-
   Align getAlignFromValue(const Value *V) const;
   Optional<MemoryLocation> getLocation(const Instruction &In) const;
   Optional<AddrInfo> getAddrInfo(Instruction &In) const;
@@ -294,6 +281,19 @@ raw_ostream &operator<<(raw_ostream &OS, const AlignVectors::ByteSpan &BS) {
 
 namespace {
 
+template <typename T> T *getIfUnordered(T *MaybeT) {
+  return MaybeT && MaybeT->isUnordered() ? MaybeT : nullptr;
+}
+template <typename T> T *isCandidate(Instruction *In) {
+  return dyn_cast<T>(In);
+}
+template <> LoadInst *isCandidate<LoadInst>(Instruction *In) {
+  return getIfUnordered(dyn_cast<LoadInst>(In));
+}
+template <> StoreInst *isCandidate<StoreInst>(Instruction *In) {
+  return getIfUnordered(dyn_cast<StoreInst>(In));
+}
+
 template <typename Pred, typename... Ts>
 void erase_if(std::map<Ts...> &map, Pred p) {
   for (auto i = map.begin(), e = map.end(); i != e;) {


        


More information about the llvm-branch-commits mailing list