[all-commits] [llvm/llvm-project] c75b25: [GVN] Load-store forwaring of scalable store to fi...

Lou via All-commits all-commits at lists.llvm.org
Thu Jan 30 02:50:03 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c75b251103a6acd785e6f43f640d7a08bd259c41
      https://github.com/llvm/llvm-project/commit/c75b251103a6acd785e6f43f640d7a08bd259c41
  Author: Lou <lou.knauer at sipearl.com>
  Date:   2025-01-30 (Thu, 30 Jan 2025)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/VNCoercion.h
    M llvm/lib/Transforms/Scalar/GVN.cpp
    M llvm/lib/Transforms/Utils/VNCoercion.cpp
    M llvm/test/Transforms/GVN/vscale.ll
    M llvm/test/Transforms/NewGVN/vscale.ll

  Log Message:
  -----------
  [GVN] Load-store forwaring of scalable store to fixed load. (#124748)

When storing a scalable vector and loading a fixed-size vector, where
the
scalable vector is known to be larger based on vscale_range, perform
store-to-load forwarding through temporary @llvm.vector.extract calls.
InstCombine then folds the insert/extract pair away.

The usecase is shown in https://godbolt.org/z/KT3sMrMbd, which shows
that clang generates IR that matches this pattern when the
"arm_sve_vector_bits" attribute is used:

```c
typedef svfloat32_t svfloat32_fixed_t
__attribute__((arm_sve_vector_bits(512)));

struct svfloat32_wrapped_t {
  svfloat32_fixed_t v;
};

static inline svfloat32_wrapped_t
add(svfloat32_wrapped_t a, svfloat32_wrapped_t b) {
  return {svadd_f32_x(svptrue_b32(), a.v, b.v)};
}

svfloat32_wrapped_t
foo(svfloat32_wrapped_t a, svfloat32_wrapped_t b) {
  // The IR pattern this patch matches is generated for this return:
  return add(a, b);
}
```



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