[llvm] 3ed8acf - [SLP][NFC]Simplify check for external user parent basic block, NFC.
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 13:23:33 PDT 2024
Author: Alexey Bataev
Date: 2024-10-11T13:11:16-07:00
New Revision: 3ed8acf2f077fe250773f2ada986c7114adcbb85
URL: https://github.com/llvm/llvm-project/commit/3ed8acf2f077fe250773f2ada986c7114adcbb85
DIFF: https://github.com/llvm/llvm-project/commit/3ed8acf2f077fe250773f2ada986c7114adcbb85.diff
LOG: [SLP][NFC]Simplify check for external user parent basic block, NFC.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 5c164075e83259..9826a8e8f8c678 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -11744,12 +11744,15 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
for (ExternalUser &EU : ExternalUses) {
// Uses by ephemeral values are free (because the ephemeral value will be
// removed prior to code generation, and so the extraction will be
- // removed as well) as well as uses in unreachable blocks or in landing pads
- // (rarely executed).
- if (EphValues.count(EU.User) ||
- (EU.User &&
- (!DT->isReachableFromEntry(cast<Instruction>(EU.User)->getParent()) ||
- cast<Instruction>(EU.User)->getParent()->isLandingPad())))
+ // removed as well).
+ if (EphValues.count(EU.User))
+ continue;
+
+ // Used in unreachable blocks or in landing pads (rarely executed).
+ if (BasicBlock *UserParent =
+ EU.User ? cast<Instruction>(EU.User)->getParent() : nullptr;
+ UserParent &&
+ (!DT->isReachableFromEntry(UserParent) || UserParent->isLandingPad()))
continue;
// We only add extract cost once for the same scalar.
More information about the llvm-commits
mailing list