Skip to content

Commit 0767c64

Browse files
committed
[VPlan] Use getDefiningRecipe instead of directly accessing Def. (NFC)
Use getDefiningRecipe to future-proof the code. Split off from #156262 as suggested.
1 parent 8c86bc8 commit 0767c64

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,20 +99,20 @@ VPValue::VPValue(const unsigned char SC, Value *UV, VPDef *Def)
9999

100100
VPValue::~VPValue() {
101101
assert(Users.empty() && "trying to delete a VPValue with remaining users");
102-
if (Def)
102+
if (VPDef *Def = getDefiningRecipe())
103103
Def->removeDefinedValue(this);
104104
}
105105

106106
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
107107
void VPValue::print(raw_ostream &OS, VPSlotTracker &SlotTracker) const {
108-
if (const VPRecipeBase *R = dyn_cast_or_null<VPRecipeBase>(Def))
108+
if (const VPRecipeBase *R = getDefiningRecipe())
109109
R->print(OS, "", SlotTracker);
110110
else
111111
printAsOperand(OS, SlotTracker);
112112
}
113113

114114
void VPValue::dump() const {
115-
const VPRecipeBase *Instr = dyn_cast_or_null<VPRecipeBase>(this->Def);
115+
const VPRecipeBase *Instr = getDefiningRecipe();
116116
VPSlotTracker SlotTracker(
117117
(Instr && Instr->getParent()) ? Instr->getParent()->getPlan() : nullptr);
118118
print(dbgs(), SlotTracker);

0 commit comments

Comments
 (0)