[llvm] [VPlan] Add specialized VPValue subclasses for different types (NFC) (PR #172758)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 31 16:09:12 PST 2025


================
@@ -129,11 +124,36 @@ void VPDef::dump() const {
 #endif
 
 VPRecipeBase *VPValue::getDefiningRecipe() {
-  return cast_or_null<VPRecipeBase>(Def);
+  auto *DefValue = dyn_cast<VPRecipeValue>(this);
+  if (!DefValue)
+    return nullptr;
+  return cast<VPRecipeBase>(DefValue->Def);
 }
 
 const VPRecipeBase *VPValue::getDefiningRecipe() const {
-  return cast_or_null<VPRecipeBase>(Def);
+  auto *DefValue = dyn_cast<VPRecipeValue>(this);
+  if (!DefValue)
+    return nullptr;
+  assert(DefValue);
+  return cast<VPRecipeBase>(DefValue->Def);
+}
+
+Value *VPValue::getLiveInIRValue() const {
----------------
ayalz wrote:

```suggestion
Value *VPValue::getIRValue() const {
```
can be done separately to reduce diff.

https://github.com/llvm/llvm-project/pull/172758


More information about the llvm-commits mailing list