[PATCH] D130466: [LICM] - Add option to allow data races

Shubham Narlawar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 12 02:39:12 PDT 2022


gsocshubham updated this revision to Diff 452118.
gsocshubham edited the summary of this revision.
gsocshubham added a comment.

Fix review comments

1. Updated patch with updated test LICM/promote-sink-store.ll - shows load hoisting and store sinking if flag is set.

2. Added a test LICM/without-allow-data-race.ll which prohibits load hoisting and store sinking if the flag is not set.

3. AllowDataRaces flag can be passed directly to clang -

`../install/bin/clang  -Ofast -S -promote-sink-store.ll emit-llvm -target aarch64-linux -mllvm -allow-data-races`

where IR is obtained from below C testcase -

  int u, v;
  
  void f(int a[restrict], int b[restrict], int n) {
      for (int i = 0; i < n; ++i) {
          if (a[i]) {
              ++u;
              break;
          }
          ++u;
          if (b[i])
              ++v;
      }
  }

TODO -

1. Remove flag `-allow-data-races` but how feasible it would be to pass thread model information from clang to LICM pass via PassBuilder?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130466/new/

https://reviews.llvm.org/D130466

Files:
  llvm/lib/Transforms/Scalar/LICM.cpp
  llvm/test/Transforms/LICM/promote-sink-store.ll
  llvm/test/Transforms/LICM/without-allow-data-race.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130466.452118.patch
Type: text/x-patch
Size: 9684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220812/8c262c80/attachment.bin>


More information about the llvm-commits mailing list