diff options
| author | Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com> | 2025-11-21 14:23:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-21 14:23:17 +0000 |
| commit | b98f6a54f6ccff67d6eb1cfa25a3f3d919c8f6c9 (patch) | |
| tree | b6557efc0552b67be61ef952cc23fa5a50941a58 | |
| parent | 31711c908fbd391601122c3457e71d0714fe4117 (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.cpp | 23 |
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; } |
