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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 5 23:52:26 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());
----------------
LiqinWeng wrote:

Add a condition `CR->getUnderlingValue != nullptr`

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


More information about the llvm-commits mailing list