Skip to content

Commit 734b016

Browse files
committed
Revert "[SLP] Improve gather tree nodes matching when users are PHIs. (#69392)"
This reverts commit c80b503. This change causes a fatal error in the backend and is filed as issue #69670.
1 parent 71bdd2c commit 734b016

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9043,7 +9043,6 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
90439043
// blocks.
90449044
if (auto *PHI = dyn_cast<PHINode>(TEUseEI.UserTE->getMainOp())) {
90459045
TEInsertBlock = PHI->getIncomingBlock(TEUseEI.EdgeIdx);
9046-
TEInsertPt = TEInsertBlock->getTerminator();
90479046
} else {
90489047
TEInsertBlock = TEInsertPt->getParent();
90499048
}
@@ -9107,10 +9106,9 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
91079106
const Instruction *InsertPt =
91089107
UserPHI ? UserPHI->getIncomingBlock(UseEI.EdgeIdx)->getTerminator()
91099108
: &getLastInstructionInBundle(UseEI.UserTE);
9110-
if (TEInsertPt == InsertPt) {
9111-
// If 2 gathers are operands of the same entry (regardless of wether
9112-
// user is PHI or else), compare operands indices, use the earlier one
9113-
// as the base.
9109+
if (!UserPHI && TEInsertPt == InsertPt) {
9110+
// If 2 gathers are operands of the same non-PHI entry,
9111+
// compare operands indices, use the earlier one as the base.
91149112
if (TEUseEI.UserTE == UseEI.UserTE && TEUseEI.EdgeIdx < UseEI.EdgeIdx)
91159113
continue;
91169114
// If the user instruction is used for some reason in different

llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
; YAML: Function: test
99
; YAML: Args:
1010
; YAML: - String: 'Stores SLP vectorized with cost '
11-
; YAML: - Cost: '-6'
11+
; YAML: - Cost: '-3'
1212
; YAML: - String: ' and with tree size '
1313
; YAML: - TreeSize: '14'
1414
; YAML: ...

0 commit comments

Comments
 (0)