[llvm] 734b016 - Revert "[SLP] Improve gather tree nodes matching when users are PHIs. (#69392)"
Douglas Yung via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 11:01:10 PDT 2023
Author: Douglas Yung
Date: 2023-10-20T10:59:07-07:00
New Revision: 734b016b66c7bc1ef93b294c9bf7bbbd2c02a044
URL: https://github.com/llvm/llvm-project/commit/734b016b66c7bc1ef93b294c9bf7bbbd2c02a044
DIFF: https://github.com/llvm/llvm-project/commit/734b016b66c7bc1ef93b294c9bf7bbbd2c02a044.diff
LOG: Revert "[SLP] Improve gather tree nodes matching when users are PHIs. (#69392)"
This reverts commit c80b50349648dcf7fcbf4ae69c62b3d34bee0c70.
This change causes a fatal error in the backend and is filed as issue #69670.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 1142d2112803106..f694ab88ccab8ea 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -9043,7 +9043,6 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
// blocks.
if (auto *PHI = dyn_cast<PHINode>(TEUseEI.UserTE->getMainOp())) {
TEInsertBlock = PHI->getIncomingBlock(TEUseEI.EdgeIdx);
- TEInsertPt = TEInsertBlock->getTerminator();
} else {
TEInsertBlock = TEInsertPt->getParent();
}
@@ -9107,10 +9106,9 @@ BoUpSLP::isGatherShuffledEntry(const TreeEntry *TE, ArrayRef<Value *> VL,
const Instruction *InsertPt =
UserPHI ? UserPHI->getIncomingBlock(UseEI.EdgeIdx)->getTerminator()
: &getLastInstructionInBundle(UseEI.UserTE);
- if (TEInsertPt == InsertPt) {
- // If 2 gathers are operands of the same entry (regardless of wether
- // user is PHI or else), compare operands indices, use the earlier one
- // as the base.
+ if (!UserPHI && TEInsertPt == InsertPt) {
+ // If 2 gathers are operands of the same non-PHI entry,
+ // compare operands indices, use the earlier one as the base.
if (TEUseEI.UserTE == UseEI.UserTE && TEUseEI.EdgeIdx < UseEI.EdgeIdx)
continue;
// If the user instruction is used for some reason in
diff erent
diff --git a/llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll b/llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll
index e5d7ad138b4def2..28e0b06f6967368 100644
--- a/llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll
+++ b/llvm/test/Transforms/SLPVectorizer/X86/matching-gather-nodes-phi-users.ll
@@ -8,7 +8,7 @@
; YAML: Function: test
; YAML: Args:
; YAML: - String: 'Stores SLP vectorized with cost '
-; YAML: - Cost: '-6'
+; YAML: - Cost: '-3'
; YAML: - String: ' and with tree size '
; YAML: - TreeSize: '14'
; YAML: ...
More information about the llvm-commits
mailing list