Skip to content

Commit 23cc5e7

Browse files
Address comments
1 parent 93a1016 commit 23cc5e7

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

llvm/include/llvm/SandboxIR/Utils.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,6 @@ class Utils {
6060
getUnderlyingObject(LSI->getPointerOperand()->Val));
6161
}
6262

63-
/// \Returns the number of elements in \p Ty. That is the number of lanes if a
64-
/// fixed vector or 1 if scalar. ScalableVectors have unknown size and
65-
/// therefore are unsupported.
66-
static int getNumElements(Type *Ty) {
67-
assert(!isa<ScalableVectorType>(Ty));
68-
return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getNumElements() : 1;
69-
}
70-
/// Returns \p Ty if scalar or its element type if vector.
71-
static Type *getElementType(Type *Ty) {
72-
return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getElementType() : Ty;
73-
}
74-
7563
/// \Returns the number of bits required to represent the operands or return
7664
/// value of \p V in \p DL.
7765
static unsigned getNumBits(Value *V, const DataLayout &DL) {

llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/SeedCollector.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ class SeedContainer {
287287
class SeedCollector {
288288
SeedContainer StoreSeeds;
289289
SeedContainer LoadSeeds;
290-
BasicBlock *BB;
291290
Context &Ctx;
292291

293292
/// \Returns the number of SeedBundle groups for all seed types.
@@ -297,11 +296,9 @@ class SeedCollector {
297296
}
298297

299298
public:
300-
SeedCollector(BasicBlock *SBBB, ScalarEvolution &SE);
299+
SeedCollector(BasicBlock *BB, ScalarEvolution &SE);
301300
~SeedCollector();
302301

303-
BasicBlock *getBasicBlock() { return BB; }
304-
305302
iterator_range<SeedContainer::iterator> getStoreSeeds() {
306303
return {StoreSeeds.begin(), StoreSeeds.end()};
307304
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===- VecUtils.h -----------------------------------------------*- C++ -*-===//
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+
// Collector for SandboxVectorizer related convenience functions that don't
10+
// belong in other classes.
11+
12+
#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H
13+
#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H
14+
15+
class Utils {
16+
public:
17+
/// \Returns the number of elements in \p Ty. That is the number of lanes if a
18+
/// fixed vector or 1 if scalar. ScalableVectors have unknown size and
19+
/// therefore are unsupported.
20+
static int getNumElements(Type *Ty) {
21+
assert(!isa<ScalableVectorType>(Ty));
22+
return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getNumElements() : 1;
23+
}
24+
/// Returns \p Ty if scalar or its element type if vector.
25+
static Type *getElementType(Type *Ty) {
26+
return Ty->isVectorTy() ? cast<FixedVectorType>(Ty)->getElementType() : Ty;
27+
}
28+
}
29+
30+
#endif LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_VECUTILS_H

llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ template bool isValidMemSeed<LoadInst>(LoadInst *LSI);
160160
template bool isValidMemSeed<StoreInst>(StoreInst *LSI);
161161

162162
SeedCollector::SeedCollector(BasicBlock *BB, ScalarEvolution &SE)
163-
: StoreSeeds(SE), LoadSeeds(SE), BB(BB), Ctx(BB->getContext()) {
163+
: StoreSeeds(SE), LoadSeeds(SE), Ctx(BB->getContext()) {
164164
// TODO: Register a callback for updating the Collector data structures upon
165165
// instr removal
166166

llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SeedCollectorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ define void @foo(ptr noalias %ptr, <2 x float> %val) {
394394
auto StoreSeedsRange = SC.getStoreSeeds();
395395
EXPECT_EQ(range_size(StoreSeedsRange), 1u);
396396
auto &SB = *StoreSeedsRange.begin();
397-
EXPECT_THAT(SB, testing::ElementsAre(St0, St2));
397+
EXPECT_THAT(SB, testing::ElementsAre(St0, St1));
398398
}
399399

400400
TEST_F(SeedBundleTest, MixedScalarVectors) {

0 commit comments

Comments
 (0)