From b98f6a54f6ccff67d6eb1cfa25a3f3d919c8f6c9 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Fri, 21 Nov 2025 14:23:17 +0000 Subject: [VPlan] Cast to VPIRMetadata in getMemoryLocation (NFC) (#169028) This allows us to strip an unnecessary TypeSwitch. --- llvm/lib/Transforms/Vectorize/VPlanUtils.cpp | 23 ++++++++++------------- 1 file 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 vputils::getMemoryLocation(const VPRecipeBase &R) { - return TypeSwitch>(&R) - .Case( - [](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(&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; } -- cgit v1.2.3