Skip to content

Commit f37e899

Browse files
committed
[VectorUtils] Accept IRBuilderBase; NFC
1 parent ec6c623 commit f37e899

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

llvm/include/llvm/Analysis/VectorUtils.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "llvm/ADT/SmallSet.h"
1818
#include "llvm/Analysis/LoopAccessAnalysis.h"
1919
#include "llvm/Analysis/TargetLibraryInfo.h"
20-
#include "llvm/IR/IRBuilder.h"
2120
#include "llvm/Support/CheckedArithmetic.h"
2221

2322
namespace llvm {
@@ -254,6 +253,7 @@ template <typename T> class ArrayRef;
254253
class DemandedBits;
255254
class GetElementPtrInst;
256255
template <typename InstTy> class InterleaveGroup;
256+
class IRBuilderBase;
257257
class Loop;
258258
class ScalarEvolution;
259259
class TargetTransformInfo;
@@ -394,7 +394,7 @@ Instruction *propagateMetadata(Instruction *I, ArrayRef<Value *> VL);
394394
/// Note: The result is a mask of 0's and 1's, as opposed to the other
395395
/// create[*]Mask() utilities which create a shuffle mask (mask that
396396
/// consists of indices).
397-
Constant *createBitMaskForGaps(IRBuilder<> &Builder, unsigned VF,
397+
Constant *createBitMaskForGaps(IRBuilderBase &Builder, unsigned VF,
398398
const InterleaveGroup<Instruction> &Group);
399399

400400
/// Create a mask with replicated elements.
@@ -409,8 +409,8 @@ Constant *createBitMaskForGaps(IRBuilder<> &Builder, unsigned VF,
409409
/// For example, the mask for \p ReplicationFactor=3 and \p VF=4 is:
410410
///
411411
/// <0,0,0,1,1,1,2,2,2,3,3,3>
412-
Constant *createReplicatedMask(IRBuilder<> &Builder, unsigned ReplicationFactor,
413-
unsigned VF);
412+
Constant *createReplicatedMask(IRBuilderBase &Builder,
413+
unsigned ReplicationFactor, unsigned VF);
414414

415415
/// Create an interleave shuffle mask.
416416
///
@@ -423,7 +423,7 @@ Constant *createReplicatedMask(IRBuilder<> &Builder, unsigned ReplicationFactor,
423423
/// For example, the mask for VF = 4 and NumVecs = 2 is:
424424
///
425425
/// <0, 4, 1, 5, 2, 6, 3, 7>.
426-
Constant *createInterleaveMask(IRBuilder<> &Builder, unsigned VF,
426+
Constant *createInterleaveMask(IRBuilderBase &Builder, unsigned VF,
427427
unsigned NumVecs);
428428

429429
/// Create a stride shuffle mask.
@@ -438,7 +438,7 @@ Constant *createInterleaveMask(IRBuilder<> &Builder, unsigned VF,
438438
/// For example, the mask for Start = 0, Stride = 2, and VF = 4 is:
439439
///
440440
/// <0, 2, 4, 6>
441-
Constant *createStrideMask(IRBuilder<> &Builder, unsigned Start,
441+
Constant *createStrideMask(IRBuilderBase &Builder, unsigned Start,
442442
unsigned Stride, unsigned VF);
443443

444444
/// Create a sequential shuffle mask.
@@ -452,7 +452,7 @@ Constant *createStrideMask(IRBuilder<> &Builder, unsigned Start,
452452
/// For example, the mask for Start = 0, NumInsts = 4, and NumUndefs = 4 is:
453453
///
454454
/// <0, 1, 2, 3, undef, undef, undef, undef>
455-
Constant *createSequentialMask(IRBuilder<> &Builder, unsigned Start,
455+
Constant *createSequentialMask(IRBuilderBase &Builder, unsigned Start,
456456
unsigned NumInts, unsigned NumUndefs);
457457

458458
/// Concatenate a list of vectors.
@@ -462,7 +462,7 @@ Constant *createSequentialMask(IRBuilder<> &Builder, unsigned Start,
462462
/// their element types should be the same. The number of elements in the
463463
/// vectors should also be the same; however, if the last vector has fewer
464464
/// elements, it will be padded with undefs.
465-
Value *concatenateVectors(IRBuilder<> &Builder, ArrayRef<Value *> Vecs);
465+
Value *concatenateVectors(IRBuilderBase &Builder, ArrayRef<Value *> Vecs);
466466

467467
/// Given a mask vector of the form <Y x i1>, Return true if all of the
468468
/// elements of this predicate mask are false or undef. That is, return true

llvm/lib/Analysis/VectorUtils.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
665665
}
666666

667667
Constant *
668-
llvm::createBitMaskForGaps(IRBuilder<> &Builder, unsigned VF,
668+
llvm::createBitMaskForGaps(IRBuilderBase &Builder, unsigned VF,
669669
const InterleaveGroup<Instruction> &Group) {
670670
// All 1's means mask is not needed.
671671
if (Group.getNumMembers() == Group.getFactor())
@@ -684,7 +684,7 @@ llvm::createBitMaskForGaps(IRBuilder<> &Builder, unsigned VF,
684684
return ConstantVector::get(Mask);
685685
}
686686

687-
Constant *llvm::createReplicatedMask(IRBuilder<> &Builder,
687+
Constant *llvm::createReplicatedMask(IRBuilderBase &Builder,
688688
unsigned ReplicationFactor, unsigned VF) {
689689
SmallVector<Constant *, 16> MaskVec;
690690
for (unsigned i = 0; i < VF; i++)
@@ -694,7 +694,7 @@ Constant *llvm::createReplicatedMask(IRBuilder<> &Builder,
694694
return ConstantVector::get(MaskVec);
695695
}
696696

697-
Constant *llvm::createInterleaveMask(IRBuilder<> &Builder, unsigned VF,
697+
Constant *llvm::createInterleaveMask(IRBuilderBase &Builder, unsigned VF,
698698
unsigned NumVecs) {
699699
SmallVector<Constant *, 16> Mask;
700700
for (unsigned i = 0; i < VF; i++)
@@ -704,7 +704,7 @@ Constant *llvm::createInterleaveMask(IRBuilder<> &Builder, unsigned VF,
704704
return ConstantVector::get(Mask);
705705
}
706706

707-
Constant *llvm::createStrideMask(IRBuilder<> &Builder, unsigned Start,
707+
Constant *llvm::createStrideMask(IRBuilderBase &Builder, unsigned Start,
708708
unsigned Stride, unsigned VF) {
709709
SmallVector<Constant *, 16> Mask;
710710
for (unsigned i = 0; i < VF; i++)
@@ -713,7 +713,7 @@ Constant *llvm::createStrideMask(IRBuilder<> &Builder, unsigned Start,
713713
return ConstantVector::get(Mask);
714714
}
715715

716-
Constant *llvm::createSequentialMask(IRBuilder<> &Builder, unsigned Start,
716+
Constant *llvm::createSequentialMask(IRBuilderBase &Builder, unsigned Start,
717717
unsigned NumInts, unsigned NumUndefs) {
718718
SmallVector<Constant *, 16> Mask;
719719
for (unsigned i = 0; i < NumInts; i++)
@@ -729,7 +729,7 @@ Constant *llvm::createSequentialMask(IRBuilder<> &Builder, unsigned Start,
729729
/// A helper function for concatenating vectors. This function concatenates two
730730
/// vectors having the same element type. If the second vector has fewer
731731
/// elements than the first, it is padded with undefs.
732-
static Value *concatenateTwoVectors(IRBuilder<> &Builder, Value *V1,
732+
static Value *concatenateTwoVectors(IRBuilderBase &Builder, Value *V1,
733733
Value *V2) {
734734
VectorType *VecTy1 = dyn_cast<VectorType>(V1->getType());
735735
VectorType *VecTy2 = dyn_cast<VectorType>(V2->getType());
@@ -752,7 +752,8 @@ static Value *concatenateTwoVectors(IRBuilder<> &Builder, Value *V1,
752752
return Builder.CreateShuffleVector(V1, V2, Mask);
753753
}
754754

755-
Value *llvm::concatenateVectors(IRBuilder<> &Builder, ArrayRef<Value *> Vecs) {
755+
Value *llvm::concatenateVectors(IRBuilderBase &Builder,
756+
ArrayRef<Value *> Vecs) {
756757
unsigned NumVecs = Vecs.size();
757758
assert(NumVecs > 1 && "Should be at least two vectors");
758759

0 commit comments

Comments
 (0)