llvm-project/llvm/test/Transforms
Djordje Todorovic 2cdc6f2ca6 Reland "[LICM] Hoist LOAD without sinking the STORE"
When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.

Please consider this small example:

loop {
  var = *ptr;
  if (var) break;
  *ptr= var + 1;
}
After this patch, it will be:

var0 = *ptr;
loop {
  var1 = phi (var0, var2);
  if (var1) break;
  var2 = var1 + 1;
  *ptr = var2;
}
This addresses some problems from [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=51193

Differential revision: https://reviews.llvm.org/D113289
2021-12-02 03:53:50 -08:00
..
ADCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AddDiscriminators [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AggressiveInstCombine [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AlignmentFromAssumptions [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
ArgumentPromotion [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
AtomicExpand
Attributor [Attributor] Introduce AAAssumptionInfo to propagate assumptions 2021-11-09 17:39:18 -05:00
BDCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
BlockExtractor
BranchFolding
CallSiteSplitting
CalledValuePropagation [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
CanonicalizeAliases
CanonicalizeFreezeInLoops [AArch64] Make -mcpu=generic schedule for an in-order core 2021-10-09 15:58:31 +01:00
CodeExtractor [CodeExtractor] Preserve topological order for the return blocks. 2021-08-25 08:09:01 -07:00
CodeGenPrepare [AArch64] Sink splat shuffles to lane index intrinsics 2021-11-22 08:11:35 +00:00
ConstantHoisting
ConstantMerge [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
ConstraintElimination [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
Coroutines Coro: Remove coro_end and coro_suspend_retcon in private unprocessed functions 2021-11-18 07:48:24 -08:00
CorrelatedValuePropagation [CVP] Remove ashr of -1 or 0 2021-11-29 15:32:09 -08:00
CrossDSOCFI
DCE [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
DFAJumpThreading
DeadArgElim [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
DeadStoreElimination [DSE] Add libcall tests for functions only available on Darwin. 2021-12-01 20:30:15 +00:00
DivRemPairs
EarlyCSE [NewPM] Use parameterized syntax for a couple of more passes 2021-08-20 14:59:21 +02:00
EliminateAvailableExternally
EntryExitInstrumenter [NewPM] Use parameterized syntax for a couple of more passes 2021-08-20 14:59:21 +02:00
ExpandMemCmp
FixIrreducible
Float2Int [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
ForcedFunctionAttrs
FunctionAttrs [tests] Precommit tests for writeonly argument attribute inference 2021-12-01 19:48:29 -08:00
FunctionImport [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
FunctionSpecialization [FuncSpec] Don't run the solver if there's nothing to do 2021-10-13 19:05:19 +01:00
GCOVProfiling
GVN [Test] Remove incorrect test in GVN 2021-11-10 15:22:43 +07:00
GVNHoist PR46874: Reset stack after visiting a node 2021-08-20 11:25:05 -07:00
GVNSink
GlobalDCE [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
GlobalMerge
GlobalOpt [GlobalOpt] Fix assertion failure during instruction deletion 2021-12-02 11:58:39 +01:00
GlobalSplit
GuardWidening [test] Remove -loop-guard-widening legacy PM tests 2021-09-05 11:36:21 -07:00
HardwareLoops [ARM] Update test comments after D114018. NFC 2021-11-16 22:48:45 +00:00
HelloNew
HotColdSplit [CodeExtractor] Preserve topological order for the return blocks. 2021-08-25 08:09:01 -07:00
IRCE [SCEVExpander] Drop poison generating flags when reusing instructions 2021-11-29 15:23:34 -08:00
IROutliner [IROutliner] Adding supports for multiple exits 2021-09-08 08:58:07 -07:00
IndVarSimplify [SCEV] Track and invalidate ValuesAtScopes users 2021-11-30 18:21:14 +01:00
IndirectBrExpand
InferAddressSpaces [InferAddressSpaces] Support assumed addrspaces from addrspace predicates. 2021-11-08 16:51:57 -05:00
InferFunctionAttrs [BuildLibCalls] Add support for memset_pattern{4,8}. 2021-12-02 11:04:25 +00:00
Inline [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
InstCombine [InstCombine] Allow fake vector insert folding to bit-logic only if the insert element is integer type 2021-11-30 13:54:52 -08:00
InstMerge Reland "[LICM] Hoist LOAD without sinking the STORE" 2021-12-02 03:53:50 -08:00
InstNamer
InstSimplify [InstSimplify] add logic fold for 'or' 2021-11-30 14:08:54 -05:00
InterleavedAccess [AArch64][SVE] Add FP types to the supported SVE structure load/stores vector type list 2021-11-08 22:29:08 +08:00
Internalize
JumpThreading Use a deterministic order when updating the DominatorTree 2021-11-29 13:14:50 +01:00
LCSSA
LICM Reland "[LICM] Hoist LOAD without sinking the STORE" 2021-12-02 03:53:50 -08:00
LoadStoreVectorizer [LSV] Change the default value of InstertElement to poison 2021-10-03 17:57:34 +09:00
LoopBoundSplit [LoopBoundSplit] Handle the case in which exiting block is loop header 2021-10-08 09:13:41 +01:00
LoopDataPrefetch [LoopDataPrefetch] Add missed LoopSimplify dependence for prefetch pass 2021-08-26 21:01:59 +08:00
LoopDeletion [LoopDeletion] Support selects when symbolically evaluating 1st iteration 2021-10-09 14:47:44 +07:00
LoopDistribute Revert rest of `IRBuilderBase`'s short-circuiting folds 2021-10-28 02:15:14 +03:00
LoopFlatten [LoopFlatten] Bail if we can't perform flattening after IV widening 2021-09-29 19:53:34 +01:00
LoopFusion
LoopIdiom Revert rest of `IRBuilderBase`'s short-circuiting folds 2021-10-28 02:15:14 +03:00
LoopInstSimplify
LoopInterchange
LoopLoadElim
LoopPredication [SCEVExpander] Drop poison generating flags when reusing instructions 2021-11-29 15:23:34 -08:00
LoopReroll
LoopRotate [InferAddressSpaces] Support assumed addrspaces from addrspace predicates. 2021-11-08 16:51:57 -05:00
LoopSimplify [test] Fixup tests with -analyze in llvm/test/Transforms 2021-09-04 16:45:51 -07:00
LoopSimplifyCFG
LoopStrengthReduce Reland [SCEV] Fix and validate ValueExprMap/ExprValueMap consistency 2021-11-27 12:37:15 +01:00
LoopTransformWarning
LoopUnroll [SCEVExpander] Drop poison generating flags when reusing instructions 2021-11-29 15:23:34 -08:00
LoopUnrollAndJam [runtime-unroll] Use incrementing IVs instead of decrementing ones 2021-11-12 15:44:58 -08:00
LoopUnswitch [Test] Regenerate checks using auto-update script 2021-10-28 15:13:43 +07:00
LoopVectorize [X86][LoopVectorize] "Fix" `X86TTIImpl::getAddressComputationCost()` 2021-11-30 10:47:56 +03:00
LoopVersioning Revert rest of `IRBuilderBase`'s short-circuiting folds 2021-10-28 02:15:14 +03:00
LoopVersioningLICM [opt] Directly translate -O# to -passes='default<O#>' 2021-10-18 16:48:10 -07:00
LowerAtomic
LowerConstantIntrinsics [LowerConstantIntrinsics] Fix heap-use-after-free bug in worklist 2021-09-21 11:33:07 +02:00
LowerExpectIntrinsic
LowerGuardIntrinsic
LowerInvoke
LowerMatrixIntrinsics [Tests] Fix incorrect noalias metadata 2021-09-18 20:51:00 +02:00
LowerSwitch
LowerTypeTests Revert rest of `IRBuilderBase`'s short-circuiting folds 2021-10-28 02:15:14 +03:00
LowerWidenableCondition
MakeGuardsExplicit
Mem2Reg [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
MemCpyOpt [OpaquePtr] Forbid mixing typed and opaque pointers 2021-09-10 15:18:23 +02:00
MergeFunc [opt] Directly translate -O# to -passes='default<O#>' 2021-10-18 16:48:10 -07:00
MergeICmps [MergeICmps] Don't reorder unmerged comparisons 2021-09-21 21:22:12 +02:00
MetaRenamer [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
NameAnonGlobals
NaryReassociate [NARY-REASSOCIATE] Fix infinite recursion optimizing min\max 2021-10-20 14:23:03 +07:00
NewGVN [MemorySSA] Support invariant.group metadata 2021-09-08 13:06:12 -07:00
ObjCARC [ObjC][ARC] Handle operand bundle "clang.arc.attachedcall" on targets 2021-11-08 18:38:39 -08:00
OpenMP [OpenMP][FIX] SPMDzation guarding needs to account for all reaching kernels 2021-12-01 11:44:32 -05:00
PGOProfile [PowerPC] Prevent the optimizer from producing wide vector types in IR. 2021-11-25 12:35:26 -06:00
PartialInlining
PartiallyInlineLibCalls
PhaseOrdering [SLP]Improve vectorization of cmp instructions sequences. 2021-12-01 07:26:29 -08:00
PlaceSafepoints
PreISelIntrinsicLowering [ObjC][ARC] Replace uses of ObjC intrinsics that are arguments of 2021-11-08 21:19:07 -08:00
PruneEH
Reassociate
Reg2Mem [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00
RelLookupTableConverter/X86
RewriteStatepointsForGC [LLVM] Inclusive terms: remove/replace references to sanity in RewriteStatepointsForGC.cpp and test 2021-10-25 16:17:41 -04:00
SCCP [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
SLPVectorizer [SLP]Improve cost model for the shuffled extracts. 2021-12-01 08:10:57 -08:00
SROA [SROA] Add new test cases to cover existing SROA behavior that structs will be scalarized. 2021-11-19 18:16:49 +00:00
SafeStack
SampleProfile profi - a flow-based profile inference algorithm: Part I (out of 3) 2021-12-01 15:30:38 -08:00
ScalarizeMaskedMemIntrin
Scalarizer [Scalarizer] Do not insert instructions between PHI nodes and debug intrinsics. 2021-11-02 09:53:59 -04:00
SeparateConstOffsetFromGEP SeparateConstOffsetFromGEP: Fix stack overflow in unreachable code 2021-09-14 19:49:38 -04:00
SimpleLoopUnswitch [SimpleLoopUnswitch] Re-fix introduction of UB when hoisted condition may be undef or poison 2021-10-12 01:02:09 +09:00
SimplifyCFG [Test] Regenerate checks using auto-update script 2021-10-28 15:13:43 +07:00
Sink
SpeculativeExecution [NewPM][test] Use -passes syntax in SpeculativeExecution lit tests 2021-10-20 15:16:17 +02:00
StraightLineStrengthReduce
StripDeadPrototypes [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
StripSymbols [NewPM][test] Strickly use -passes in some more lit tests 2021-10-20 17:06:47 +02:00
StructurizeCFG
SyntheticCountsPropagation
TailCallElim [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
ThinLTOBitcodeWriter
TypePromotion/ARM [TypePromotion] Extend TypePromotion::isSafeWrap 2021-11-14 11:18:31 +00:00
UnifyFunctionExitNodes
UnifyLoopExits
Util [test] Use -passes syntax when specifying pipeline in some more tests 2021-11-27 09:52:55 +01:00
VectorCombine [VectorCombine] fold shuffle-of-binops with common operand 2021-10-21 12:37:54 -04:00
WholeProgramDevirt [test] Update some test cases to use -passes when specifying the pipeline 2021-09-29 21:51:08 +02:00