summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-11-21 14:23:17 +0000
committerGitHub <noreply@github.com>2025-11-21 14:23:17 +0000
commitb98f6a54f6ccff67d6eb1cfa25a3f3d919c8f6c9 (patch)
treeb6557efc0552b67be61ef952cc23fa5a50941a58
parent31711c908fbd391601122c3457e71d0714fe4117 (diff)
[VPlan] Cast to VPIRMetadata in getMemoryLocation (NFC) (#169028)
This allows us to strip an unnecessary TypeSwitch.
-rw-r--r--llvm/lib/Transforms/Vectorize/VPlanUtils.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
index 2536d61392ed..cffc40960e47 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
@@ -397,17 +397,14 @@ bool VPBlockUtils::isLatch(const VPBlockBase *VPB,
std::optional<MemoryLocation>
vputils::getMemoryLocation(const VPRecipeBase &R) {
- return TypeSwitch<const VPRecipeBase *, std::optional<MemoryLocation>>(&R)
- .Case<VPWidenMemoryRecipe, VPInterleaveBase, VPReplicateRecipe>(
- [](auto *S) {
- MemoryLocation Loc;
- // Populate noalias metadata from VPIRMetadata.
- if (MDNode *NoAliasMD = S->getMetadata(LLVMContext::MD_noalias))
- Loc.AATags.NoAlias = NoAliasMD;
- if (MDNode *AliasScopeMD =
- S->getMetadata(LLVMContext::MD_alias_scope))
- Loc.AATags.Scope = AliasScopeMD;
- return Loc;
- })
- .Default([](auto *) { return std::nullopt; });
+ auto *M = dyn_cast<VPIRMetadata>(&R);
+ if (!M)
+ return std::nullopt;
+ MemoryLocation Loc;
+ // Populate noalias metadata from VPIRMetadata.
+ if (MDNode *NoAliasMD = M->getMetadata(LLVMContext::MD_noalias))
+ Loc.AATags.NoAlias = NoAliasMD;
+ if (MDNode *AliasScopeMD = M->getMetadata(LLVMContext::MD_alias_scope))
+ Loc.AATags.Scope = AliasScopeMD;
+ return Loc;
}