[llvm] [Vectorize] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125159)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 20:15:27 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/125159
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect InVectors.front() and P to be nonnull.
>From b2f0d33cf96a0f5cfa522fc9adca9cd250a15eae Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 30 Jan 2025 19:20:32 -0800
Subject: [PATCH] [Vectorize] Migrate away from PointerUnion::dyn_cast (NFC)
Note that PointerUnion::dyn_cast has been soft deprecated in
PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa<T>, cast<T> and the llvm::dyn_cast<T>
Literal migration would result in dyn_cast_if_present (see the
definition of PointerUnion::dyn_cast), but this patch uses dyn_cast
because we expect InVectors.front() and P to be nonnull.
---
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index f89944f5a0bfc7..eba838151a69f0 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -10354,7 +10354,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
SameNodesEstimated = false;
if (!E2 && InVectors.size() == 1) {
unsigned VF = E1.getVectorFactor();
- if (Value *V1 = InVectors.front().dyn_cast<Value *>()) {
+ if (Value *V1 = dyn_cast<Value *>(InVectors.front())) {
VF = std::max(VF,
cast<FixedVectorType>(V1->getType())->getNumElements());
} else {
@@ -10370,7 +10370,7 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
auto P = InVectors.front();
Cost += createShuffle(&E1, E2, Mask);
unsigned VF = Mask.size();
- if (Value *V1 = P.dyn_cast<Value *>()) {
+ if (Value *V1 = dyn_cast<Value *>(P)) {
VF = std::max(VF,
getNumElements(V1->getType()));
} else {
More information about the llvm-commits
mailing list