1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib
Alina Sbirlea 6bd8c535b7 [LICM & MSSA] Limit unsafe sinking and hoisting.
Summary:
The getClobberingMemoryAccess API checks for clobbering accesses in a loop by walking the backedge. This may check if a memory access is being
clobbered by the loop in a previous iteration, depending how smart AA got over the course of the updates in MemorySSA (it does not occur when built from scratch).
If no clobbering access is found inside the loop, it will optimize to an access outside the loop. This however does not mean that access is safe to sink.
Given:
```
for i
  load a[i]
  store a[i]
```
The access corresponding to the load can be optimized to outside the loop, and the load can be hoisted. But it is incorrect to sink it.
In order to sink the load, we'd need to check no Def clobbers the Use in the same iteration. With this patch we currently restrict sinking to either
Defs not existing in the loop, or Defs preceding the load in the same block. An easy extension is to ensure the load (Use) post-dominates all Defs.

Caught by PR42294.

This issue also shed light on the converse problem: hoisting stores in this same scenario would be illegal. With this patch we restrict
hoisting of stores to the case when their corresponding Defs are dominating all Uses in the loop.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

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

llvm-svn: 363982
2019-06-20 21:09:09 +00:00
..
Analysis [MemorySSA] Cleanup trivial phis. 2019-06-19 21:33:09 +00:00
AsmParser [SVE][IR] Scalable Vector IR Type with pr42210 fix 2019-06-18 10:11:56 +00:00
BinaryFormat hwasan: Add a tag_offset DWARF attribute to instrumented stack variables. 2019-06-17 23:39:41 +00:00
Bitcode [SVE][IR] Scalable Vector IR Type with pr42210 fix 2019-06-18 10:11:56 +00:00
CodeGen [DAGCombiner] Use getAPIntValue() instead of getZExtValue() where possible. 2019-06-20 17:36:23 +00:00
DebugInfo [llvm-dwarfdump] --gdb-index: fix uninitialized TuListOffset 2019-06-19 13:51:29 +00:00
Demangle
ExecutionEngine [JITLink] Move JITLinkMemoryManager into its own header. 2019-06-14 19:41:21 +00:00
Fuzzer
FuzzMutate
IR Add debug location verification for !llvm.loop attachments. 2019-06-18 20:09:09 +00:00
IRReader
LineEditor
Linker
LTO [Remarks] Extend -fsave-optimization-record to specify the format 2019-06-17 16:06:00 +00:00
MC MCContext: Delete unused functions 2019-06-18 12:30:06 +00:00
MCA [MCA] Ignore invalid processor resource writes of zero cycles. NFCI 2019-06-14 13:31:21 +00:00
Object
ObjectYAML [yaml2obj/obj2yaml] - Make RawContentSection::Info Optional<> 2019-06-19 08:57:38 +00:00
Option
Passes [clang][NewPM] Do not eliminate available_externally durng -O2 -flto runs 2019-06-20 19:44:51 +00:00
ProfileData [Coverage] Speculative fix for r363325 for an older compiler 2019-06-14 00:03:22 +00:00
Remarks
Support [FileCheck] Stop qualifying expressions as numeric 2019-06-19 23:47:24 +00:00
TableGen
Target AMDGPU: Insert mem_viol check loop around GWS pre-GFX9 2019-06-20 20:54:32 +00:00
Testing
TextAPI
ToolDrivers
Transforms [LICM & MSSA] Limit unsafe sinking and hoisting. 2019-06-20 21:09:09 +00:00
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt