@@ -6861,7 +6861,7 @@ BoUpSLP::getReorderingData(const TreeEntry &TE, bool TopToBottom,
6861
6861
return std::move(ResOrder);
6862
6862
}
6863
6863
if (TE.State == TreeEntry::StridedVectorize && !TopToBottom &&
6864
- (!TE.UserTreeIndex || !TE.UserTreeIndex.UserTE->hasState() ||
6864
+ (!TE.UserTreeIndex ||
6865
6865
!Instruction::isBinaryOp(TE.UserTreeIndex.UserTE->getOpcode())) &&
6866
6866
(TE.ReorderIndices.empty() || isReverseOrder(TE.ReorderIndices)))
6867
6867
return std::nullopt;
@@ -15704,8 +15704,7 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
15704
15704
const BasicBlock *TEInsertBlock = nullptr;
15705
15705
// Main node of PHI entries keeps the correct order of operands/incoming
15706
15706
// blocks.
15707
- if (auto *PHI = dyn_cast_or_null<PHINode>(
15708
- TEUseEI.UserTE->hasState() ? TEUseEI.UserTE->getMainOp() : nullptr);
15707
+ if (auto *PHI = dyn_cast<PHINode>(TEUseEI.UserTE->getMainOp());
15709
15708
PHI && TEUseEI.UserTE->State != TreeEntry::SplitVectorize) {
15710
15709
TEInsertBlock = PHI->getIncomingBlock(TEUseEI.EdgeIdx);
15711
15710
TEInsertPt = TEInsertBlock->getTerminator();
@@ -15804,8 +15803,7 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
15804
15803
"Expected only single user of a gather node.");
15805
15804
const EdgeInfo &UseEI = TEPtr->UserTreeIndex;
15806
15805
15807
- PHINode *UserPHI = (UseEI.UserTE->State != TreeEntry::SplitVectorize &&
15808
- UseEI.UserTE->hasState())
15806
+ PHINode *UserPHI = UseEI.UserTE->State != TreeEntry::SplitVectorize
15809
15807
? dyn_cast<PHINode>(UseEI.UserTE->getMainOp())
15810
15808
: nullptr;
15811
15809
Instruction *InsertPt =
@@ -15818,8 +15816,7 @@ BoUpSLP::isGatherShuffledSingleRegisterEntry(
15818
15816
TEUseEI.UserTE->isAltShuffle()) &&
15819
15817
all_of(TEUseEI.UserTE->Scalars, isUsedOutsideBlock)) {
15820
15818
if (UseEI.UserTE->State != TreeEntry::Vectorize ||
15821
- (UseEI.UserTE->hasState() &&
15822
- UseEI.UserTE->getOpcode() == Instruction::PHI &&
15819
+ (UseEI.UserTE->getOpcode() == Instruction::PHI &&
15823
15820
!UseEI.UserTE->isAltShuffle()) ||
15824
15821
!all_of(UseEI.UserTE->Scalars, isUsedOutsideBlock))
15825
15822
continue;
@@ -16441,31 +16438,24 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
16441
16438
// Get the basic block this bundle is in. All instructions in the bundle
16442
16439
// should be in this block (except for extractelement-like instructions with
16443
16440
// constant indices or gathered loads or copyables).
16444
- Instruction *Front;
16445
- unsigned Opcode;
16446
- if (E->hasState()) {
16447
- Front = E->getMainOp();
16448
- Opcode = E->getOpcode();
16449
- } else {
16450
- Front = cast<Instruction>(*find_if(E->Scalars, IsaPred<Instruction>));
16451
- Opcode = Front->getOpcode();
16452
- }
16441
+ auto *Front = E->getMainOp();
16453
16442
auto *BB = Front->getParent();
16454
- assert(
16455
- ((GatheredLoadsEntriesFirst.has_value() && Opcode == Instruction::Load &&
16456
- E->isGather() && E->Idx < *GatheredLoadsEntriesFirst) ||
16457
- E->State == TreeEntry::SplitVectorize || E->hasCopyableElements() ||
16458
- all_of(E->Scalars,
16459
- [=](Value *V) -> bool {
16460
- if (Opcode == Instruction::GetElementPtr &&
16461
- !isa<GetElementPtrInst>(V))
16462
- return true;
16463
- auto *I = dyn_cast<Instruction>(V);
16464
- return !I || !E->getMatchingMainOpOrAltOp(I) ||
16465
- I->getParent() == BB || isVectorLikeInstWithConstOps(I);
16466
- })) &&
16467
- "Expected gathered loads or GEPs or instructions from same basic "
16468
- "block.");
16443
+ assert(((GatheredLoadsEntriesFirst.has_value() &&
16444
+ E->getOpcode() == Instruction::Load && E->isGather() &&
16445
+ E->Idx < *GatheredLoadsEntriesFirst) ||
16446
+ E->State == TreeEntry::SplitVectorize || E->hasCopyableElements() ||
16447
+ all_of(E->Scalars,
16448
+ [=](Value *V) -> bool {
16449
+ if (E->getOpcode() == Instruction::GetElementPtr &&
16450
+ !isa<GetElementPtrInst>(V))
16451
+ return true;
16452
+ auto *I = dyn_cast<Instruction>(V);
16453
+ return !I || !E->getMatchingMainOpOrAltOp(I) ||
16454
+ I->getParent() == BB ||
16455
+ isVectorLikeInstWithConstOps(I);
16456
+ })) &&
16457
+ "Expected gathered loads or GEPs or instructions from same basic "
16458
+ "block.");
16469
16459
16470
16460
auto FindLastInst = [&]() {
16471
16461
Instruction *LastInst = Front;
@@ -16480,13 +16470,13 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
16480
16470
LastInst = I;
16481
16471
continue;
16482
16472
}
16483
- assert(((Opcode == Instruction::GetElementPtr &&
16473
+ assert(((E->getOpcode() == Instruction::GetElementPtr &&
16484
16474
!isa<GetElementPtrInst>(I)) ||
16485
16475
E->State == TreeEntry::SplitVectorize ||
16486
16476
(isVectorLikeInstWithConstOps(LastInst) &&
16487
16477
isVectorLikeInstWithConstOps(I)) ||
16488
16478
(GatheredLoadsEntriesFirst.has_value() &&
16489
- Opcode == Instruction::Load && E->isGather() &&
16479
+ E->getOpcode() == Instruction::Load && E->isGather() &&
16490
16480
E->Idx < *GatheredLoadsEntriesFirst)) &&
16491
16481
"Expected vector-like or non-GEP in GEP node insts only.");
16492
16482
if (!DT->isReachableFromEntry(LastInst->getParent())) {
@@ -16522,11 +16512,11 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
16522
16512
FirstInst = I;
16523
16513
continue;
16524
16514
}
16525
- assert(((Opcode == Instruction::GetElementPtr &&
16526
- !isa<GetElementPtrInst>(I)) ||
16527
- (isVectorLikeInstWithConstOps(FirstInst) &&
16528
- isVectorLikeInstWithConstOps(I))) &&
16529
- "Expected vector-like or non-GEP in GEP node insts only.");
16515
+ assert(((E->getOpcode() == Instruction::GetElementPtr &&
16516
+ !isa<GetElementPtrInst>(I)) ||
16517
+ (isVectorLikeInstWithConstOps(FirstInst) &&
16518
+ isVectorLikeInstWithConstOps(I))) &&
16519
+ "Expected vector-like or non-GEP in GEP node insts only.");
16530
16520
if (!DT->isReachableFromEntry(FirstInst->getParent())) {
16531
16521
FirstInst = I;
16532
16522
continue;
@@ -16564,7 +16554,7 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
16564
16554
// Set insertpoint for gathered loads to the very first load.
16565
16555
if (GatheredLoadsEntriesFirst.has_value() &&
16566
16556
E->Idx >= *GatheredLoadsEntriesFirst && !E->isGather() &&
16567
- Opcode == Instruction::Load) {
16557
+ E->getOpcode() == Instruction::Load) {
16568
16558
Res = FindFirstInst();
16569
16559
EntryToLastInstruction.try_emplace(E, Res);
16570
16560
return *Res;
@@ -16596,7 +16586,7 @@ Instruction &BoUpSLP::getLastInstructionInBundle(const TreeEntry *E) {
16596
16586
};
16597
16587
const ScheduleBundle *Bundle = FindScheduleBundle(E);
16598
16588
if (!E->isGather() && !Bundle) {
16599
- if ((Opcode == Instruction::GetElementPtr &&
16589
+ if ((E->getOpcode() == Instruction::GetElementPtr &&
16600
16590
any_of(E->Scalars,
16601
16591
[](Value *V) {
16602
16592
return !isa<GetElementPtrInst>(V) && isa<Instruction>(V);
@@ -21011,10 +21001,9 @@ void BoUpSLP::computeMinimumValueSizes() {
21011
21001
if (!isa<CastInst, BinaryOperator, FreezeInst, PHINode,
21012
21002
SelectInst>(U) ||
21013
21003
isa<SIToFPInst, UIToFPInst>(U) ||
21014
- (UserTE->hasState() &&
21015
- (!isa<CastInst, BinaryOperator, FreezeInst, PHINode,
21016
- SelectInst>(UserTE->getMainOp()) ||
21017
- isa<SIToFPInst, UIToFPInst>(UserTE->getMainOp()))))
21004
+ !isa<CastInst, BinaryOperator, FreezeInst, PHINode,
21005
+ SelectInst>(UserTE->getMainOp()) ||
21006
+ isa<SIToFPInst, UIToFPInst>(UserTE->getMainOp()))
21018
21007
return true;
21019
21008
unsigned UserTESz = DL->getTypeSizeInBits(
21020
21009
UserTE->Scalars.front()->getType());
@@ -21264,7 +21253,6 @@ void BoUpSLP::computeMinimumValueSizes() {
21264
21253
NodeIdx < VectorizableTree.size() &&
21265
21254
VectorizableTree[NodeIdx]->UserTreeIndex &&
21266
21255
VectorizableTree[NodeIdx]->UserTreeIndex.EdgeIdx == 0 &&
21267
- VectorizableTree[NodeIdx]->UserTreeIndex.UserTE->hasState() &&
21268
21256
VectorizableTree[NodeIdx]->UserTreeIndex.UserTE->getOpcode() ==
21269
21257
Instruction::Trunc &&
21270
21258
!VectorizableTree[NodeIdx]->UserTreeIndex.UserTE->isAltShuffle();
0 commit comments