1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/include/llvm/Transforms/Utils
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
..
AddDiscriminators.h
ASanStackFrameLayout.h
BasicBlockUtils.h
BreakCriticalEdges.h
BuildLibCalls.h [SimplifyLibCalls] Fold more fortified functions into non-fortified variants 2019-05-31 22:41:36 +00:00
BypassSlowDivision.h
CallPromotionUtils.h
CanonicalizeAliases.h
Cloning.h [CallSite removal] Refactoring llvm::InlineFunction APIs 2019-06-05 21:28:13 +00:00
CodeExtractor.h
CtorUtils.h
EntryExitInstrumenter.h
EscapeEnumerator.h
Evaluator.h
FunctionComparator.h
FunctionImportUtils.h
GlobalStatus.h
GuardUtils.h
ImportedFunctionsInliningStatistics.h
IntegerDivision.h
LCSSA.h
LibCallsShrinkWrap.h
Local.h [DebugInfoMetadata] Refactor DIExpression::prepend constants (NFC) 2019-05-20 10:35:57 +00:00
LoopRotationUtils.h
LoopSimplify.h [MemorySSA] Teach LoopSimplify to preserve MemorySSA. 2019-05-08 17:05:36 +00:00
LoopUtils.h [LICM & MSSA] Limit unsafe sinking and hoisting. 2019-06-20 21:09:09 +00:00
LoopVersioning.h
LowerInvoke.h
LowerMemIntrinsics.h
Mem2Reg.h
ModuleUtils.h
NameAnonGlobals.h
PredicateInfo.h
PromoteMemToReg.h
SanitizerStats.h
SimplifyIndVar.h
SimplifyLibCalls.h [SimplifyLibCalls] Fold more fortified functions into non-fortified variants 2019-05-31 22:41:36 +00:00
SizeOpts.h Fix header guard typo and build error. 2019-04-15 17:29:21 +00:00
SplitModule.h
SSAUpdater.h
SSAUpdaterBulk.h
SSAUpdaterImpl.h
SymbolRewriter.h
UnifyFunctionExitNodes.h
UnrollLoop.h [Utils] Clean another duplicated util method. 2019-06-04 18:45:15 +00:00
ValueMapper.h
VNCoercion.h