[clang] [llvm] [LV][LAA] Vectorize math lib calls with mem write-only attribute (PR #78432)

Paschalis Mpeis via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 08:52:15 PDT 2024


================
@@ -0,0 +1,117 @@
+; RUN: opt < %s -mattr=+sve -vector-library=ArmPL -passes=inject-tli-mappings,loop-vectorize -debug-only=loop-accesses -disable-output 2>&1 | FileCheck %s
+
+; REQUIRES: asserts
+
+target triple = "aarch64-unknown-linux-gnu"
+
+; TODO: add mappings for frexp/frexpf
----------------
paschalis-mpeis wrote:

Short answer: Not needed.

---

**Longer answer:**
Using `-passes='print<access-info>'` (as per @mgabka suggestion), LAA pass can run regardless of vecLib existence, TLI mappings, and/or even SVE support.

Previously, in the LAA test [attr-mem-write-only.ll](https://github.com/llvm/llvm-project/pull/78432/commits/c3aa63c98627c2edf16420c5a4aa53ba233d544c#diff-6e65eaeb2e328f78d3620c102adaa22dd2a4e6bd0e677208ecb32e772c21089c) I had:
- `-mattr=+sve -vector-library=ArmPL -passes=inject-tli-mappings,loop-vectorize`

and yet, I couldn't check for the fexpr calls, as `LoopVectorizationLegality` would not allow vectorization.

With the latest patch, however, LAA runs regardless, so I'm able to do such checks already ([here](https://github.com/llvm/llvm-project/pull/78432/commits/c3aa63c98627c2edf16420c5a4aa53ba233d544c#diff-6e65eaeb2e328f78d3620c102adaa22dd2a4e6bd0e677208ecb32e772c21089cR7) and [here](https://github.com/llvm/llvm-project/pull/78432/commits/c3aa63c98627c2edf16420c5a4aa53ba233d544c#diff-6e65eaeb2e328f78d3620c102adaa22dd2a4e6bd0e677208ecb32e772c21089cR34)).

In the future, when the mappings for frexp are added, only the LV tests would need to be updated ([AArch64/veclib-function-calls-linear-ptrs.ll](https://github.com/llvm/llvm-project/pull/78432/commits/c3aa63c98627c2edf16420c5a4aa53ba233d544c#diff-7dd871d3ed08b76c541f7abb3a1d170800dab9d90dd16c4795ad747c94a17e65)).

https://github.com/llvm/llvm-project/pull/78432


More information about the cfe-commits mailing list