[llvm] 0767c64 - [VPlan] Use getDefiningRecipe instead of directly accessing Def. (NFC)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 10 13:55:38 PST 2025
Author: Florian Hahn
Date: 2025-11-10T21:55:19Z
New Revision: 0767c640437a8ff02e431a350168a13cb9056428
URL: https://github.com/llvm/llvm-project/commit/0767c640437a8ff02e431a350168a13cb9056428
DIFF: https://github.com/llvm/llvm-project/commit/0767c640437a8ff02e431a350168a13cb9056428.diff
LOG: [VPlan] Use getDefiningRecipe instead of directly accessing Def. (NFC)
Use getDefiningRecipe to future-proof the code. Split off from
https://github.com/llvm/llvm-project/pull/156262 as suggested.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 5e4303a4c5fff..90696ffc3aca7 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -99,20 +99,20 @@ VPValue::VPValue(const unsigned char SC, Value *UV, VPDef *Def)
VPValue::~VPValue() {
assert(Users.empty() && "trying to delete a VPValue with remaining users");
- if (Def)
+ if (VPDef *Def = getDefiningRecipe())
Def->removeDefinedValue(this);
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
void VPValue::print(raw_ostream &OS, VPSlotTracker &SlotTracker) const {
- if (const VPRecipeBase *R = dyn_cast_or_null<VPRecipeBase>(Def))
+ if (const VPRecipeBase *R = getDefiningRecipe())
R->print(OS, "", SlotTracker);
else
printAsOperand(OS, SlotTracker);
}
void VPValue::dump() const {
- const VPRecipeBase *Instr = dyn_cast_or_null<VPRecipeBase>(this->Def);
+ const VPRecipeBase *Instr = getDefiningRecipe();
VPSlotTracker SlotTracker(
(Instr && Instr->getParent()) ? Instr->getParent()->getPlan() : nullptr);
print(dbgs(), SlotTracker);
More information about the llvm-commits
mailing list