[llvm] [LV] Use getFixedValue instead of getKnownMinValue when appropriate (PR #143526)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 05:53:53 PDT 2025
================
@@ -5342,6 +5342,10 @@ LoopVectorizationCostModel::getUniformMemOpCost(Instruction *I,
StoreInst *SI = cast<StoreInst>(I);
bool IsLoopInvariantStoreValue = Legal->isInvariant(SI->getValueOperand());
+ // TODO: We have tests that request the cost of extracting element
+ // VF.getKnownMinValue() - 1 from a scalable vector. This is actually
+ // meaningless, given what we actually want is the last lane and is likely
+ // to be more expensive.
----------------
david-arm wrote:
I did update the comment. See second commit in the PR:
```
-// TODO: We have tests that request the cost of extracting element
-// VF.getKnownMinValue() - 1 from a scalable vector. This is actually
-// meaningless, given what we actually want is the last lane and is likely
-// to be more expensive.
+// TODO: We have existing tests that request the cost of extracting element
+// VF.getKnownMinValue() - 1 from a scalable vector. This does not represent
+// the actual generated code, which involves extracting the last element of
+// a scalable vector where the lane to extract is unknown at compile time.
```
I'm not sure what you were expecting the updated comment to contain? You said `Might be good to adjust the comment a bit, we have tests to exercise this code, but might be clearer to just explain the problematic code path?` and I thought my updated comment was explaining the problematic code path? Which is that asking for the cost of extracting lane `VF.getKnownMinValue() - 1` does not represent the actual generated code, which for SVE at least would be whilelo + lastb instructions.
https://github.com/llvm/llvm-project/pull/143526
More information about the llvm-commits
mailing list