Skip to content

Commit 3ed8acf

Browse files
committed
[SLP][NFC]Simplify check for external user parent basic block, NFC.
1 parent 16c8056 commit 3ed8acf

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11744,12 +11744,15 @@ InstructionCost BoUpSLP::getTreeCost(ArrayRef<Value *> VectorizedVals) {
1174411744
for (ExternalUser &EU : ExternalUses) {
1174511745
// Uses by ephemeral values are free (because the ephemeral value will be
1174611746
// removed prior to code generation, and so the extraction will be
11747-
// removed as well) as well as uses in unreachable blocks or in landing pads
11748-
// (rarely executed).
11749-
if (EphValues.count(EU.User) ||
11750-
(EU.User &&
11751-
(!DT->isReachableFromEntry(cast<Instruction>(EU.User)->getParent()) ||
11752-
cast<Instruction>(EU.User)->getParent()->isLandingPad())))
11747+
// removed as well).
11748+
if (EphValues.count(EU.User))
11749+
continue;
11750+
11751+
// Used in unreachable blocks or in landing pads (rarely executed).
11752+
if (BasicBlock *UserParent =
11753+
EU.User ? cast<Instruction>(EU.User)->getParent() : nullptr;
11754+
UserParent &&
11755+
(!DT->isReachableFromEntry(UserParent) || UserParent->isLandingPad()))
1175311756
continue;
1175411757

1175511758
// We only add extract cost once for the same scalar.

0 commit comments

Comments
 (0)