Skip to content

Commit cae4e9b

Browse files
author
Leon Clark
committed
Address comments.
1 parent d0b3d68 commit cae4e9b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3520,10 +3520,10 @@ bool VectorCombine::foldInterleaveIntrinsics(Instruction &I) {
35203520
return true;
35213521
}
35223522

3523-
// Attempt to narrow a phi of shufflevector instructions where the two incoming
3524-
// values have the same operands but different masks. If the two shuffle masks
3525-
// are offsets of one another we can use one branch to rotate the incoming
3526-
// vector and perform one larger shuffle after the phi.
3523+
/// Attempt to narrow a phi of shufflevector instructions where the two incoming
3524+
/// values have the same operands but different masks. If the two shuffle masks
3525+
/// are offsets of one another we can use one branch to rotate the incoming
3526+
/// vector and perform one larger shuffle after the phi.
35273527
bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
35283528
auto *Phi = dyn_cast<PHINode>(&I);
35293529
if (!Phi || Phi->getNumIncomingValues() != 2u)
@@ -3566,8 +3566,7 @@ bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
35663566
// Ensure all elements of the new mask are equal. If the difference between
35673567
// the incoming mask elements is the same, the two must be constant offsets
35683568
// of one another.
3569-
if (NewMask.empty() ||
3570-
!std::equal(NewMask.begin() + 1u, NewMask.end(), NewMask.begin()))
3569+
if (NewMask.empty() || !all_equal(NewMask))
35713570
return false;
35723571

35733572
// Create new mask using difference of the two incoming masks.
@@ -3591,8 +3590,7 @@ bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
35913590
return false;
35923591

35933592
// Create new shuffles and narrowed phi.
3594-
auto Builder = IRBuilder(&I);
3595-
Builder.SetInsertPoint(Shuf);
3593+
auto Builder = IRBuilder(Shuf);
35963594
Builder.SetCurrentDebugLocation(Shuf->getDebugLoc());
35973595
auto *PoisonVal = PoisonValue::get(InputVT);
35983596
auto *NewShuf0 = Builder.CreateShuffleVector(Op, PoisonVal, NewMask);

0 commit comments

Comments
 (0)