[all-commits] [llvm/llvm-project] 63e8f6: [LV][AArch64] LoopVectorizer allows scalable frem ...

Paschalis Mpeis via All-commits all-commits at lists.llvm.org
Thu Jan 4 03:36:07 PST 2024


  Branch: refs/heads/users/paschalis-mpeis/loop-vectorizer-frem-scalable
  Home:   https://github.com/llvm/llvm-project
  Commit: 63e8f68d5ec9fccef81a56c14cde72f1c6b3d99f
      https://github.com/llvm/llvm-project/commit/63e8f68d5ec9fccef81a56c14cde72f1c6b3d99f
  Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
  Date:   2024-01-04 (Thu, 04 Jan 2024)

  Changed paths:
    M llvm/lib/Analysis/TargetTransformInfo.cpp
    M llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
    M llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll
    M llvm/test/Analysis/CostModel/AArch64/arith-fp.ll

  Log Message:
  -----------
  [LV][AArch64] LoopVectorizer allows scalable frem instructions

In AArch64, when an 'frem' instruction uses scalable vectors, it will be
replaced with a vector library call. LoopVectorize is now aware of that
so it no longer returns invalid costs.

When it is not scalable, it returns the default costs, which are
delegated to the BaseT TTI Implementation.


  Commit: a041258a20f9b7d0bb165e03e1d317ce95024b8c
      https://github.com/llvm/llvm-project/commit/a041258a20f9b7d0bb165e03e1d317ce95024b8c
  Author: Paschalis Mpeis <Paschalis.Mpeis at arm.com>
  Date:   2024-01-04 (Thu, 04 Jan 2024)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
    M llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
    A llvm/test/Analysis/CostModel/AArch64/arith-fp-sve-frem.ll
    M llvm/test/Analysis/CostModel/AArch64/arith-fp-sve.ll

  Log Message:
  -----------
  [LV][AArch64] LoopVectorizer allows scalable frem instructions

LoopVectorizer is aware when a target can replace a scalable frem
instruction with a vector library call and it returns the relevant cost.
Otherwise, it returns an invalid cost (as previously).

Add test that check costs on AArch64, when there is no vector library
available and when there is, with and without tail-folding.

NOTE: Invoking CostModel directly (not through LV) would still return
invalid costs. To avoid this, it would require passing TargetLibraryInfo
to TargetTransformInfo API, which we preferred not to as the 'frem'
instruction is an isolated case.


Compare: https://github.com/llvm/llvm-project/compare/8e85c511665a...a041258a20f9


More information about the All-commits mailing list