File tree Expand file tree Collapse file tree 3 files changed +40
-9
lines changed
include/llvm/Transforms/Vectorize/SandboxVectorizer Expand file tree Collapse file tree 3 files changed +40
-9
lines changed Original file line number Diff line number Diff line change @@ -134,15 +134,13 @@ class VecUtils {
134
134
return ScalarTy;
135
135
}
136
136
// / \Returns the first integer power of 2 that is <= Num.
137
- static unsigned getFloorPowerOf2 (unsigned Num) {
138
- if (Num == 0 )
139
- return Num;
140
- unsigned Mask = Num;
141
- Mask >>= 1 ;
142
- for (unsigned ShiftBy = 1 ; ShiftBy < sizeof (Num) * 8 ; ShiftBy <<= 1 )
143
- Mask |= Mask >> ShiftBy;
144
- return Num & ~Mask;
145
- }
137
+ static unsigned getFloorPowerOf2 (unsigned Num);
138
+
139
+ #ifndef NDEBUG
140
+ // / Helper dump function for debugging.
141
+ LLVM_DUMP_METHOD static void dump (ArrayRef<Value *> Bndl);
142
+ LLVM_DUMP_METHOD static void dump (ArrayRef<Instruction *> Bndl);
143
+ #endif // NDEBUG
146
144
};
147
145
148
146
} // namespace llvm::sandboxir
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ add_llvm_component_library(LLVMVectorize
13
13
SandboxVectorizer/SandboxVectorizerPassBuilder.cpp
14
14
SandboxVectorizer/Scheduler.cpp
15
15
SandboxVectorizer/SeedCollector.cpp
16
+ SandboxVectorizer/VecUtils.cpp
16
17
SLPVectorizer.cpp
17
18
Vectorize.cpp
18
19
VectorCombine.cpp
Original file line number Diff line number Diff line change
1
+ // ===- VecUtils.cpp -------------------------------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+
9
+ #include " llvm/Transforms/Vectorize/SandboxVectorizer/VecUtils.h"
10
+
11
+ namespace llvm ::sandboxir {
12
+
13
+ unsigned VecUtils::getFloorPowerOf2 (unsigned Num) {
14
+ if (Num == 0 )
15
+ return Num;
16
+ unsigned Mask = Num;
17
+ Mask >>= 1 ;
18
+ for (unsigned ShiftBy = 1 ; ShiftBy < sizeof (Num) * 8 ; ShiftBy <<= 1 )
19
+ Mask |= Mask >> ShiftBy;
20
+ return Num & ~Mask;
21
+ }
22
+
23
+ #ifndef NDEBUG
24
+ template <typename T> static void dumpImpl (ArrayRef<T *> Bndl) {
25
+ for (auto [Idx, V] : enumerate(Bndl))
26
+ dbgs () << Idx << " ." << *V << " \n " ;
27
+ }
28
+ void VecUtils::dump (ArrayRef<Value *> Bndl) { dumpImpl (Bndl); }
29
+ void VecUtils::dump (ArrayRef<Instruction *> Bndl) { dumpImpl (Bndl); }
30
+ #endif // NDEBUG
31
+
32
+ } // namespace llvm::sandboxir
You can’t perform that action at this time.
0 commit comments