[all-commits] [llvm/llvm-project] 9983b9: [SROA] Precommit test for D124967

Dmitry Vasilyev via All-commits all-commits at lists.llvm.org
Tue May 17 02:26:41 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9983b978f756f150caf6ac4fb2c74bd8c71de7c0
      https://github.com/llvm/llvm-project/commit/9983b978f756f150caf6ac4fb2c74bd8c71de7c0
  Author: Dmitry Vassiliev <dvassiliev at accesssoftek.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    A llvm/test/Transforms/SROA/lifetime-intrinsic.ll

  Log Message:
  -----------
  [SROA] Precommit test for D124967


  Commit: 7759680e2f88f6d055c37aeb77302874a72f19ce
      https://github.com/llvm/llvm-project/commit/7759680e2f88f6d055c37aeb77302874a72f19ce
  Author: Dmitry Vassiliev <dvassiliev at accesssoftek.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SROA.cpp
    M llvm/test/Transforms/SROA/lifetime-intrinsic.ll

  Log Message:
  -----------
  [SROA] Avoid postponing rewriting load/store by ignoring lifetime intrinsics in partition's promotability checking

This patch fixes a bug that generates unnecessary packing/unpacking structure code because of incorrectly handling lifetime intrinsic.
For example, a partition of an alloca may contain many slices:
```
Partition [0, 4):
  Slice0: [0, 4) used by: load i32 addr;
  Slice1: [0, 4) used by: store i32 v, addr;
  Slice2: [0, 16) used by lifetime.start(16, addr);
```
When SROA determines if the partition can be promoted, lifetime.start is currently treated as a whole alloca load/store, so Slice0 and Slice1 cannot be promoted at this attempt,
but the packing/unpacking code for Slice0 and Slice1 has been generated.
After rewrite lifetime.start/end intrinsic, SROA tries again with Slice0 and Slice1 and finally promotes them, but redundant packing/unpacking code remaining in the IRs.
This patch changes promotability checking to ignore lifetime intrinsic (they will be rewritten to correct sizes later), so we can promote the real users (load/store) at the first attempt with optimal code.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D124967


Compare: https://github.com/llvm/llvm-project/compare/f00f894d5d82...7759680e2f88


More information about the All-commits mailing list