For loads following stores in the same basic block, replace their result with the data that was stored. It transforms the output of the StoresInMultipleBlocks test from: sub rsp,38h mov dword ptr [rsp],0Dh cmp ecx,0 je a mov dword ptr [rsp],4 add dword ptr [rsp],3 b: mov eax,dword ptr [rsp] add rsp,38h ret a: mov dword ptr [rsp],6 add dword ptr [rsp],5 jmp b Into: sub rsp,38h mov dword ptr [rsp],0Dh cmp ecx,0 je a mov dword ptr [rsp],4 mov eax,4 add eax,3 mov dword ptr [rsp],eax b: mov eax,dword ptr [rsp] add rsp,38h ret a: mov dword ptr [rsp],6 mov eax,6 add eax,5 mov dword ptr [rsp],eax jmp b While at first this might seem like a regression, note that `add [rsp],3` performs both a load and a store. The optimization pass eliminated two load operations from this test. The redundant stores will be eliminated by a subsequent change. Also adds a unit test for the case where store-to-load propagation should not be performed due to an indirect store through a pointer happening in between. Bug: b/179668593 Change-Id: I6ca133ac4e77bbbc3efd517dff6e8dee6d2dc147 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52533 Kokoro-Result: kokoro <noreply+kokoro@google.com> Tested-by:Nicolas Capens <nicolascapens@google.com> Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| BUILD.gn | Loading commit data... | |
| CMakeLists.txt | Loading commit data... | |
| CPUID.cpp | Loading commit data... | |
| CPUID.hpp | Loading commit data... | |
| Coroutine.hpp | Loading commit data... | |
| Debug.cpp | Loading commit data... | |
| Debug.hpp | Loading commit data... | |
| EmulatedIntrinsics.cpp | Loading commit data... | |
| EmulatedIntrinsics.hpp | Loading commit data... | |
| ExecutableMemory.cpp | Loading commit data... | |
| ExecutableMemory.hpp | Loading commit data... | |
| LLVMAsm.cpp | Loading commit data... | |
| LLVMAsm.hpp | Loading commit data... | |
| LLVMJIT.cpp | Loading commit data... | |
| LLVMReactor.cpp | Loading commit data... | |
| LLVMReactor.hpp | Loading commit data... | |
| LLVMReactorDebugInfo.cpp | Loading commit data... | |
| LLVMReactorDebugInfo.hpp | Loading commit data... | |
| Nucleus.hpp | Loading commit data... | |
| OptimalIntrinsics.cpp | Loading commit data... | |
| OptimalIntrinsics.hpp | Loading commit data... | |
| Optimizer.cpp | Loading commit data... | |
| Optimizer.hpp | Loading commit data... | |
| Print.hpp | Loading commit data... | |
| Reactor.cpp | Loading commit data... | |
| Reactor.hpp | Loading commit data... | |
| ReactorDebugInfo.cpp | Loading commit data... | |
| ReactorDebugInfo.hpp | Loading commit data... | |
| Routine.hpp | Loading commit data... | |
| SubzeroReactor.cpp | Loading commit data... | |
| Traits.hpp | Loading commit data... | |
| Traits.inl | Loading commit data... | |
| reactor.gni | Loading commit data... | |
| x86.hpp | Loading commit data... |