Skip to content

Commit 98fb688

Browse files
author
Leon Clark
committed
Address comments.
1 parent 896d320 commit 98fb688

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
@@ -3692,10 +3692,10 @@ bool VectorCombine::foldInterleaveIntrinsics(Instruction &I) {
36923692
return true;
36933693
}
36943694

3695-
// Attempt to narrow a phi of shufflevector instructions where the two incoming
3696-
// values have the same operands but different masks. If the two shuffle masks
3697-
// are offsets of one another we can use one branch to rotate the incoming
3698-
// vector and perform one larger shuffle after the phi.
3695+
/// Attempt to narrow a phi of shufflevector instructions where the two incoming
3696+
/// values have the same operands but different masks. If the two shuffle masks
3697+
/// are offsets of one another we can use one branch to rotate the incoming
3698+
/// vector and perform one larger shuffle after the phi.
36993699
bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
37003700
auto *Phi = dyn_cast<PHINode>(&I);
37013701
if (!Phi || Phi->getNumIncomingValues() != 2u)
@@ -3738,8 +3738,7 @@ bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
37383738
// Ensure all elements of the new mask are equal. If the difference between
37393739
// the incoming mask elements is the same, the two must be constant offsets
37403740
// of one another.
3741-
if (NewMask.empty() ||
3742-
!std::equal(NewMask.begin() + 1u, NewMask.end(), NewMask.begin()))
3741+
if (NewMask.empty() || !all_equal(NewMask))
37433742
return false;
37443743

37453744
// Create new mask using difference of the two incoming masks.
@@ -3763,8 +3762,7 @@ bool VectorCombine::shrinkPhiOfShuffles(Instruction &I) {
37633762
return false;
37643763

37653764
// Create new shuffles and narrowed phi.
3766-
auto Builder = IRBuilder(&I);
3767-
Builder.SetInsertPoint(Shuf);
3765+
auto Builder = IRBuilder(Shuf);
37683766
Builder.SetCurrentDebugLocation(Shuf->getDebugLoc());
37693767
auto *PoisonVal = PoisonValue::get(InputVT);
37703768
auto *NewShuf0 = Builder.CreateShuffleVector(Op, PoisonVal, NewMask);

0 commit comments

Comments
 (0)