[all-commits] [llvm/llvm-project] 193052: [LoopVectorize] Fix cost model assert when vectori...

David Sherwood via All-commits all-commits at lists.llvm.org
Fri Feb 7 01:37:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1930524bbde3cd26ff527bbdb5e1f937f484edd6
      https://github.com/llvm/llvm-project/commit/1930524bbde3cd26ff527bbdb5e1f937f484edd6
  Author: David Sherwood <david.sherwood at arm.com>
  Date:   2025-02-07 (Fri, 07 Feb 2025)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    M llvm/test/Transforms/LoopVectorize/AArch64/masked-call.ll

  Log Message:
  -----------
  [LoopVectorize] Fix cost model assert when vectorising calls (#125716)

The legacy and vplan cost models did not agree because
VPWidenCallRecipe::computeCost only calculates the cost of the
call instruction, whereas
LoopVectorizationCostModel::setVectorizedCallDecision in some
cases adds on the cost of a synthesised mask argument. However,
this mask is always 'splat(i1 true)' which should be hoisted out
of the loop during codegen. In order to synchronise the two cost
models I have two options:

1) Also add the cost of the splat to the vplan model, or
2) Remove the cost of the splat from the legacy model.

I chose 2) because I feel this more closely represents what the
final code will look like. There is an argument that we should
take account of such broadcast costs in the preheader when
deciding if it's profitable to vectorise a loop, however there
isn't currently a mechanism to do this. We currently only take
account of the runtime checks when assessing profitability and
what the minimum trip count should be. However, I don't believe
this work needs doing as part of this PR.



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