[llvm] [VPlan] First step towards VPlan cost modeling. (PR #67934)

Renato Golin via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 28 10:23:46 PDT 2024


================
@@ -913,9 +913,14 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
         unsigned ExtOpcode = match(R.getOperand(0), m_SExt(m_VPValue()))
                                  ? Instruction::SExt
                                  : Instruction::ZExt;
-        auto *VPC =
-            new VPWidenCastRecipe(Instruction::CastOps(ExtOpcode), A, TruncTy);
-        VPC->insertBefore(&R);
+        VPValue *VPC;
+        if (auto *UV = R.getOperand(0)->getUnderlyingValue())
----------------
rengolin wrote:

nit: couldn't you just set UV to `nullptr`? Or return `nullptr` from `getUnderlyingValue`?

Then this would just be a single call. It took me a second pass to parse the semantics here.

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


More information about the llvm-commits mailing list