[llvm] [VPlan] Preserve underlying value when EVL transforming intrinsics/casts (PR #121552)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 23:56:00 PST 2025


================
@@ -1506,8 +1506,12 @@ static VPRecipeBase *createEVLRecipe(VPValue *HeaderMask,
             SmallVector<VPValue *> Ops(CR->operands());
             Ops.push_back(&AllOneMask);
             Ops.push_back(&EVL);
-            return new VPWidenIntrinsicRecipe(
+            auto *VPR = new VPWidenIntrinsicRecipe(
                 VPID, Ops, TypeInfo.inferScalarType(CR), CR->getDebugLoc());
+            // Preserve the underlying value as some cast instructions may have
+            // their cost skipped in collectValuesToIgnore
+            VPR->setUnderlyingValue(CR->getUnderlyingValue());
----------------
lukel97 wrote:

As in an assertion? I think it's possible for a VPWidenIntrinsicRecipe to have no underlying value if constructed with the `VPWidenIntrinsicRecipe(Intrinsic::ID, ArrayRef<VPValue *>, Type *, DebugLoc)` constructor

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


More information about the llvm-commits mailing list