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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 02:17:45 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>(
----------------
MacDue wrote:

Here's the post on this: https://discourse.llvm.org/t/psa-swapping-out-or-null-with-if-present/65018 It does not seem like there was much of a consensus.

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


More information about the llvm-commits mailing list