Skip to content

Commit ec228d7

Browse files
committed
[InstCombine] Use SmallBitVector for convienently checking if all bits are set
1 parent 42ada5f commit ec228d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/ADT/ArrayRef.h"
1717
#include "llvm/ADT/DenseMap.h"
1818
#include "llvm/ADT/STLExtras.h"
19+
#include "llvm/ADT/SmallBitVector.h"
1920
#include "llvm/ADT/SmallVector.h"
2021
#include "llvm/Analysis/InstructionSimplify.h"
2122
#include "llvm/Analysis/VectorUtils.h"
@@ -771,7 +772,7 @@ static Instruction *foldInsSequenceIntoSplat(InsertElementInst &InsElt) {
771772

772773
Value *SplatVal = InsElt.getOperand(1);
773774
InsertElementInst *CurrIE = &InsElt;
774-
SmallVector<bool, 16> ElementPresent(NumElements, false);
775+
SmallBitVector ElementPresent(NumElements, false);
775776
InsertElementInst *FirstIE = nullptr;
776777

777778
// Walk the chain backwards, keeping track of which indices we inserted into,
@@ -803,7 +804,7 @@ static Instruction *foldInsSequenceIntoSplat(InsertElementInst &InsElt) {
803804
// TODO: If the base vector is not undef, it might be better to create a splat
804805
// and then a select-shuffle (blend) with the base vector.
805806
if (!isa<UndefValue>(FirstIE->getOperand(0)))
806-
if (any_of(ElementPresent, [](bool Present) { return !Present; }))
807+
if (!ElementPresent.all())
807808
return nullptr;
808809

809810
// Create the insert + shuffle.

0 commit comments

Comments
 (0)