[PATCH] D83311: [CodeMoverUtils] Add optional data dependence checks using MSSA

Whitney Tsang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 18 04:10:05 PDT 2020


Whitney added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/CodeMoverUtils.cpp:264
+      // read after write dependency on same memory location
+      if (InstDefMA == CurInstLastDefMA || InstDefMA == CurInstMA)
+        return true;
----------------
bmahjour wrote:
> Do we really need `InstDefMA == CurInstLastDefMA ||`? See my comment above.
This is needed for cases like
```
store 1, ptr
x = load ptr
store 0, ptr
```
check if `x` is safe to move after `store 0, ptr`. 
e.g. in https://reviews.llvm.org/D83543
```
// Anti forward dependency
EXPECT_FALSE(isSafeToMoveBefore(*LoadA1, *StoreB1, DT, &PDT, &DI));
```
the defining access of `x` is `store 1, ptr`, the `getClobberingMemoryAccess` of `store 0, ptr` is `x`.
Not sure if this works if there is no store before the memory use.
I wonder if there is a better to do this, like if there is a way to directly get `x` from `store 0, ptr`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83311





More information about the llvm-commits mailing list