[all-commits] [llvm/llvm-project] 855178: [SLP]Fix/improve getSpillCost analysis

Alexey Bataev via All-commits all-commits at lists.llvm.org
Tue Mar 4 12:47:45 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 855178af99ac6597f3ae09c3c9b7edbc37b28009
      https://github.com/llvm/llvm-project/commit/855178af99ac6597f3ae09c3c9b7edbc37b28009
  Author: Alexey Bataev <a.bataev at outlook.com>
  Date:   2025-03-04 (Tue, 04 Mar 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
    M llvm/test/Transforms/SLPVectorizer/RISCV/math-function.ll
    M llvm/test/Transforms/SLPVectorizer/RISCV/spillcost.ll

  Log Message:
  -----------
  [SLP]Fix/improve getSpillCost analysis

Previous implementation may took some extra time, when walked over the
same instructions several times. And also it did not include proper
analysis for cross-basic-block use of the vectorized values. This
version fixes it.

It walks over the tree and checks the deps between entries and their
operands. If there are non-vectorized calls in between, it adds
a single(!) spill cost, because the vector value should be
spilled/reloaded only once.

Also, this version caches analysis for each entries, which are detected,
and do not repeats it, uses data, found during previous analysis for
previous nodes.

Also, it has the internal limit. If the number of instructions
between nodes and their operands is too big (> than ScheduleRegionSizeBudget / VectorizableTree.size()), it is considered that the spill is required. It allows to improve compile time.

Reviewers: preames, RKSimon, mikhailramalho

Reviewed By: preames

Pull Request: https://github.com/llvm/llvm-project/pull/129258



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