[all-commits] [llvm/llvm-project] 3ca069: [CodeGen][TTI] Reduce funnel shift cost for consta...

Jim Lin via All-commits all-commits at lists.llvm.org
Wed Mar 11 18:50:25 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ca069c471cfb22f3ecf9cbe38b273322729b326
      https://github.com/llvm/llvm-project/commit/3ca069c471cfb22f3ecf9cbe38b273322729b326
  Author: Jim Lin <jim at andestech.com>
  Date:   2026-03-12 (Thu, 12 Mar 2026)

  Changed paths:
    M llvm/include/llvm/CodeGen/BasicTTIImpl.h
    M llvm/test/Analysis/CostModel/AArch64/fshl.ll
    M llvm/test/Analysis/CostModel/AArch64/fshr.ll
    M llvm/test/Analysis/CostModel/RISCV/fshl_fshr.ll
    M llvm/test/Analysis/CostModel/X86/fshl.ll
    M llvm/test/Analysis/CostModel/X86/fshr.ll
    A llvm/test/Transforms/SLPVectorizer/RISCV/funnel-shift-cost.ll

  Log Message:
  -----------
  [CodeGen][TTI] Reduce funnel shift cost for constant shift amounts (#184942)

The Sub instruction cost and the shift-by-zero handling costs (ICmp +
Select) are only needed when the shift amount is non-constant. Move them
inside the `!OpInfoZ.isConstant()` guard to avoid overestimating cost
for constant shift amounts.

The overestimated scalar cost caused SLP vectorizer to incorrectly
prefer vectorizing funnel shifts with constant shift amounts, since SLP
compares vector cost against scalar cost and a falsely high scalar cost
makes vectorization appear more profitable than it actually is.

Fixes #181308.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list