[llvm] [LV] Fix the cost model for freeze instructions (PR #197188)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 05:17:02 PDT 2026


================
@@ -992,9 +992,9 @@ InstructionCost VPRecipeWithIRFlags::getCostForRecipeWithOpcode(
         RHSInfo, Operands, CtxI, &Ctx.TLI);
   }
   case Instruction::Freeze:
-    // This opcode is unknown. Assume that it is the same as 'mul'.
-    return Ctx.TTI.getArithmeticInstrCost(Instruction::Mul, ResultTy,
-                                          Ctx.CostKind);
+    // This will never lead to any real code being generated. It acts purely
+    // as a blocker for optimizations.
+    return 0;
----------------
david-arm wrote:

How? The TTI hook requires an instruction. I think it's a bad idea to pass in a null User.

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


More information about the llvm-commits mailing list