diff options
author | Rhys Perry <pendingchaos02@gmail.com> | 2019-05-17 09:32:23 +0000 |
---|---|---|
committer | Rhys Perry <pendingchaos02@gmail.com> | 2019-05-17 09:32:23 +0000 |
commit | c4bc61bad7b29659181d0a9e3ae409c46bb39392 (patch) | |
tree | 8f9970fcb3628ca98db3e2854b4ba166ca20419a /llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp | |
parent | 929af67361275feafc07d02458af7657f754c029 (diff) | |
download | bcm5719-llvm-c4bc61bad7b29659181d0a9e3ae409c46bb39392.tar.gz bcm5719-llvm-c4bc61bad7b29659181d0a9e3ae409c46bb39392.zip |
[AMDGPU] detect WaW hazards when moving/merging load/store instructions
Summary:
In order to combine memory operations efficiently, the load/store
optimizer might move some instructions around. It's usually safe
to move instructions down past the merged instruction because the
pass checks if memory operations can be re-ordered.
Though, the current logic doesn't handle Write-after-Write hazards.
This fixes a reflection issue with Monster Hunter World and DXVK.
v2: - rebased on top of master
- clean up the test case
- handle WaW hazards correctly
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=40130
Original patch by Samuel Pitoiset.
Reviewers: tpr, arsenm, nhaehnle
Reviewed By: nhaehnle
Subscribers: ronlieb, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye
Differential Revision: https://reviews.llvm.org/D61313
llvm-svn: 361008
Diffstat (limited to 'llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp index b7541e0df62..461f7b213d2 100644 --- a/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp +++ b/llvm/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp @@ -281,6 +281,7 @@ static bool addToListsIfDependent(MachineInstr &MI, DenseSet<unsigned> &RegDefs, // registers are in SSA form. if (Use.isReg() && ((Use.readsReg() && RegDefs.count(Use.getReg())) || + (Use.isDef() && RegDefs.count(Use.getReg())) || (Use.isDef() && TargetRegisterInfo::isPhysicalRegister(Use.getReg()) && PhysRegUses.count(Use.getReg())))) { Insts.push_back(&MI); |