[llvm] [VPlan] Improve cast code in VPlanRecipes (NFC) (PR #141240)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon May 26 04:55:43 PDT 2025


================
@@ -85,8 +85,8 @@ bool VPRecipeBase::mayWriteToMemory() const {
   case VPWidenPHISC:
   case VPWidenSC:
   case VPWidenSelectSC: {
-    const Instruction *I =
-        dyn_cast_or_null<Instruction>(getVPSingleValue()->getUnderlyingValue());
+    const Instruction *I = dyn_cast_if_present<Instruction>(
----------------
fhahn wrote:

Is there any benefit of using `dyn_cast_if_present` over `dyn_cast_or_null`? There seem to be only very few uses of the former compared to the latter in `llvm/`

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


More information about the llvm-commits mailing list