@@ -6725,9 +6725,9 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
67256725 bool IsScatterVectorizeUserTE =
67266726 UserTreeIdx.UserTE &&
67276727 UserTreeIdx.UserTE->State == TreeEntry::ScatterVectorize;
6728- bool AreAllSameInsts =
6729- (S.getOpcode() && allSameBlock(VL)) ||
6730- (S.OpValue->getType()->isPointerTy() && IsScatterVectorizeUserTE &&
6728+ bool AreAllSameBlock = S.getOpcode() && allSameBlock(VL);
6729+ bool AreScatterAllGEPSameBlock =
6730+ (IsScatterVectorizeUserTE && S.OpValue->getType()->isPointerTy() &&
67316731 VL.size() > 2 &&
67326732 all_of(VL,
67336733 [&BB](Value *V) {
@@ -6741,6 +6741,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
67416741 BB &&
67426742 sortPtrAccesses(VL, UserTreeIdx.UserTE->getMainOp()->getType(), *DL, *SE,
67436743 SortedIndices));
6744+ bool AreAllSameInsts = AreAllSameBlock || AreScatterAllGEPSameBlock;
67446745 if (!AreAllSameInsts || allConstant(VL) || isSplat(VL) ||
67456746 (isa<InsertElementInst, ExtractValueInst, ExtractElementInst>(
67466747 S.OpValue) &&
@@ -6820,9 +6821,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth,
68206821
68216822 // Special processing for sorted pointers for ScatterVectorize node with
68226823 // constant indeces only.
6823- if (AreAllSameInsts && UserTreeIdx.UserTE &&
6824- UserTreeIdx.UserTE->State == TreeEntry::ScatterVectorize &&
6825- !(S.getOpcode() && allSameBlock(VL))) {
6824+ if (!AreAllSameBlock && AreScatterAllGEPSameBlock) {
68266825 assert(S.OpValue->getType()->isPointerTy() &&
68276826 count_if(VL, IsaPred<GetElementPtrInst>) >= 2 &&
68286827 "Expected pointers only.");
0 commit comments