[llvm] [LV] Return Invalid from getLegacyCost when instruction cost forced. (PR #154543)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 07:31:59 PDT 2025
================
@@ -6760,9 +6760,10 @@ void LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
InstructionCost VPCostContext::getLegacyCost(Instruction *UI,
ElementCount VF) const {
- if (ForceTargetInstructionCost.getNumOccurrences())
+ InstructionCost Cost = CM.getInstructionCost(UI, VF);
+ if (Cost.isValid() && ForceTargetInstructionCost.getNumOccurrences())
return InstructionCost(ForceTargetInstructionCost.getNumOccurrences());
- return CM.getInstructionCost(UI, VF);
----------------
fhahn wrote:
Yes, to test this we need a test that passes a large value, e.g. ` -force-target-instruction-cost=100` in `llvm/test/Transforms/LoopVectorize/AArch64/force-target-instruction-cost.ll` would do it
https://github.com/llvm/llvm-project/pull/154543
More information about the llvm-commits
mailing list