[llvm] [X86][CostModel] Fix lane and index accounting in split gather/scatter (PR #220565)
Sumukh J Bharadwaj via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 6 12:58:38 PDT 2026
amd-subharad wrote:
Correction to my earlier comment: this is **not** closing. I said I would fold it into #199488, but that is not what happened, and #199488 is better off as it stands.
#199488's generic `getGSVectorCost` is untouched upstream code — it still recurses on the narrowed type, still returns 1 for `TCK_CodeSize`, and still takes the pointer width from address space 0. Its gather/scatter pricing sits entirely behind the `prefer-gs-cost-table` tuning feature. That is what @MattPD confirmed there on 3 Sep ("the broad generic overhead change and its effects on Intel vector costs were removed"), and it should stay that way.
So the three generic corrections live only here, which is also where they can get the independent cross-target and cost-kind validation asked for in that thread:
- lanes are no longer dropped when the vector length is not a multiple of the split factor — a `v9i32` gather was costed as eight lanes;
- the index width is chosen once for the operation rather than recomputed per part;
- the index width comes from the pointer's own address space instead of assuming address space 0.
No existing cost expectation changes: the diff to `masked-intrinsic-cost.ll` is +18/-2, and both deletions are function-signature lines. The shapes that move are ones no test covered — indivisible vector lengths, and the 32-bit address spaces 270 and 271. CI is green.
Ready for review.
https://github.com/llvm/llvm-project/pull/220565
More information about the llvm-commits
mailing list