[llvm] [Vectorize] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125159)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 20:15:56 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/125159.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+2-2)
``````````diff
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/125159
More information about the llvm-commits
mailing list