llvm-project/llvm/lib/Transforms/Scalar
Whitney Tsang 36bdc3dc35 [LoopFusion] Move instructions from FC0.Latch to FC1.Latch.
Summary:This PR move instructions from FC0.Latch bottom up to the
beginning of FC1.Latch as long as they are proven safe.

To illustrate why this is beneficial, let's consider the following
example:
Before Fusion:
header1:
  br header2
header2:
  br header2, latch1
latch1:
  br header1, preheader3
preheader3:
  br header3
header3:
  br header4
header4:
  br header4, latch3
latch3:
  br header3, exit3

After Fusion (before this PR):
header1:
  br header2
header2:
  br header2, latch1
latch1:
  br header3
header3:
  br header4
header4:
  br header4, latch3
latch3:
  br header1, exit3

Note that preheader3 is removed during fusion before this PR.
Notice that we cannot fuse loop2 with loop4 as there exists block latch1
in between.
This PR move instructions from latch1 to beginning of latch3, and remove
block latch1. LoopFusion is now able to fuse loop nest recursively.

After Fusion (after this PR):
header1:
  br header2
header2:
  br header3
header3:
  br header4
header4:
  br header2, latch3
latch3:
  br header1, exit3

Reviewer: kbarton, jdoerfert, Meinersbur, dmgreen, fhahn, hfinkel,
bmahjour, etiotto
Reviewed By: kbarton, Meinersbur
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D71165
2019-12-17 22:10:23 +00:00
..
ADCE.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
AlignmentFromAssumptions.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
BDCE.cpp Clang-trunk Generates Wrong Debug values with -O1 2019-11-21 13:53:10 -08:00
CMakeLists.txt [Matrix] Add first set of matrix intrinsics and initial lowering pass. 2019-12-12 15:42:18 +00:00
CallSiteSplitting.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
ConstantHoisting.cpp Rename TTI::getIntImmCost for instructions and intrinsics 2019-12-11 18:00:20 -08:00
ConstantProp.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
CorrelatedValuePropagation.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
DCE.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
DeadStoreElimination.cpp Revert "[DSE] Fix for a dangling point bug in DeadStoreElimination." 2019-12-05 19:29:21 +00:00
DivRemPairs.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
EarlyCSE.cpp [DebugInfo][EarlyCSE] Use the salvageDebugInfoOrMarkUndef(); NFC 2019-12-09 13:57:35 +01:00
FlattenCFGPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Float2Int.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
GVN.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
GVNHoist.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
GVNSink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
GuardWidening.cpp Broaden the definition of a "widenable branch" 2019-11-21 10:46:16 -08:00
IVUsersPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IndVarSimplify.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
InductiveRangeCheckElimination.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
InferAddressSpaces.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
InstSimplifyPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
JumpThreading.cpp [JumpThreading] NFC: Don't cache F.hasProfileData() 2019-11-22 08:51:14 -08:00
LICM.cpp [MemorySSA] Moving at the end often means before terminator. 2019-11-20 17:11:00 -08:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopAccessAnalysisPrinter.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopDataPrefetch.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopDeletion.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopDistribute.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopFuse.cpp [LoopFusion] Move instructions from FC0.Latch to FC1.Latch. 2019-12-17 22:10:23 +00:00
LoopIdiomRecognize.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
LoopInstSimplify.cpp [LoopInstSimplify] Move MemorySSA verification under flag. 2019-11-21 17:01:24 -08:00
LoopInterchange.cpp [LoopInterchange] Improve inner exit loop safety checks. 2019-12-04 17:46:01 +00:00
LoopLoadElimination.cpp [PGO][PGSO] Add an optional query type parameter to shouldOptimizeForSize. 2019-12-02 13:54:13 -08:00
LoopPassManager.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
LoopPredication.cpp [LoopPred] Robustly handle partially unswitched loops 2019-11-21 15:44:36 -08:00
LoopRerollPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopRotation.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
LoopSimplifyCFG.cpp [MemorySSA] Update analysis when the terminator is a memory instruction. 2019-11-20 16:36:52 -08:00
LoopSink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopStrengthReduce.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopUnrollAndJamPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopUnrollPass.cpp [PGO][PGSO] Add an optional query type parameter to shouldOptimizeForSize. 2019-12-02 13:54:13 -08:00
LoopUnswitch.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LoopVersioningLICM.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerAtomic.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerConstantIntrinsics.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerExpectIntrinsic.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
LowerGuardIntrinsic.cpp Move widenable branch formation into makeGuardControlFlowExplicit helper 2019-11-20 12:54:05 -08:00
LowerMatrixIntrinsics.cpp [Matrix] Add first set of matrix intrinsics and initial lowering pass. 2019-12-12 15:42:18 +00:00
LowerWidenableCondition.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MakeGuardsExplicit.cpp D'oh. Fix assert after a84922916e. 2019-11-20 22:22:51 -05:00
MemCpyOptimizer.cpp Resubmit "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove" 2019-12-17 10:07:46 +01:00
MergeICmps.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
MergedLoadStoreMotion.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
NaryReassociate.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
NewGVN.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PartiallyInlineLibCalls.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
PlaceSafepoints.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Reassociate.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Reg2Mem.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
RewriteStatepointsForGC.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SCCP.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SROA.cpp [Alignment][NFC] Introduce Align in IRBuilder 2019-12-11 14:41:23 +01:00
Scalar.cpp [BasicBlockUtils] Add utility to remove redundant dbg.value instrs 2019-12-16 11:41:21 +01:00
Scalarizer.cpp Remove Support/Options.h, it is unused 2019-11-15 13:32:52 -08:00
SeparateConstOffsetFromGEP.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SimpleLoopUnswitch.cpp [LCSSA] Don't use VH callbacks to invalidate SCEV when creating LCSSA phis 2019-12-06 13:21:49 +07:00
SimplifyCFGPass.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
Sink.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
SpeculateAroundPHIs.cpp Rename TTI::getIntImmCost for instructions and intrinsics 2019-12-11 18:00:20 -08:00
SpeculativeExecution.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StraightLineStrengthReduce.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
StructurizeCFG.cpp Add missing includes needed to prune LLVMContext.h include, NFC 2019-11-14 15:23:15 -08:00
TailRecursionElimination.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00
WarnMissedTransforms.cpp Sink all InitializePasses.h includes 2019-11-13 16:34:37 -08:00