llvm-project/llvm/lib/Transforms/Scalar
Max Kazantsev 541f824d32 [IndVars] Strengthen restricton in rewriteLoopExitValues
For some unclear reason rewriteLoopExitValues considers recalculation
after the loop profitable if it has some "soft uses" outside the loop (i.e. any
use other than call and return), even if we have proved that it has a user inside
the loop which we think will not be optimized away.

There is no existing unit test that would explain this. This patch provides an
example when rematerialisation of exit value is not profitable but it passes
this check due to presence of a "soft use" outside the loop.

It makes no sense to recalculate value on exit if we are going to compute it
due to some irremovable within the loop. This patch disallows applying this
transform in the described situation.

Differential Revision: https://reviews.llvm.org/D51581
Reviewed By: etherzhhb

llvm-svn: 345708
2018-10-31 10:30:50 +00:00
..
ADCE.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
AlignmentFromAssumptions.cpp Remove trailing space 2018-07-30 19:41:25 +00:00
BDCE.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
CMakeLists.txt [UnrollAndJam] New Unroll and Jam pass 2018-07-01 12:47:30 +00:00
CallSiteSplitting.cpp Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC 2018-10-19 06:12:02 +00:00
ConstantHoisting.cpp Revert "Revert "[ConstHoist] Do not rebase single (or few) dependent constant"" 2018-09-26 00:59:09 +00:00
ConstantProp.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
CorrelatedValuePropagation.cpp [Dominators] Convert existing passes and utils to use the DomTreeUpdater class 2018-08-03 05:08:17 +00:00
DCE.cpp [DCE] Add DebugCounter support 2018-09-13 20:29:50 +00:00
DeadStoreElimination.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
DivRemPairs.cpp Reland r338431: "Add DebugCounters to DivRemPairs" 2018-08-01 23:14:14 +00:00
EarlyCSE.cpp [EarlyCSEwMemorySSA] Add MSSA verification and tests to make EarlyCSE failures easier to track. 2018-09-17 22:35:21 +00:00
FlattenCFGPass.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Float2Int.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
GVN.cpp [TI removal] Remove `TerminatorInst` from GVN.h and GVN.cpp. 2018-10-15 10:00:15 +00:00
GVNHoist.cpp [TI removal] Make `getTerminator()` return a generic `Instruction`. 2018-10-15 10:42:50 +00:00
GVNSink.cpp llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) 2018-09-27 02:13:45 +00:00
GuardWidening.cpp llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) 2018-09-27 02:13:45 +00:00
IVUsersPrinter.cpp
IndVarSimplify.cpp [IndVars] Strengthen restricton in rewriteLoopExitValues 2018-10-31 10:30:50 +00:00
InductiveRangeCheckElimination.cpp Remove trailing space 2018-07-30 19:41:25 +00:00
InferAddressSpaces.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
InstSimplifyPass.cpp [instsimplify] Move the instsimplify pass to use more obvious file names 2018-06-29 23:36:03 +00:00
JumpThreading.cpp [TI removal] Remove `TerminatorInst` from BasicBlockUtils.h 2018-10-15 09:34:05 +00:00
LICM.cpp [NFC] Make LoopSafetyInfo abstract to allow alternative implementations 2018-10-16 08:31:05 +00:00
LLVMBuild.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
LoopAccessAnalysisPrinter.cpp
LoopDataPrefetch.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopDeletion.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopDistribute.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LoopIdiomRecognize.cpp [InstCombine] Cleanup libfunc attribute inferring 2018-10-16 21:18:31 +00:00
LoopInstSimplify.cpp Update MemorySSA in LoopInstSimplify. 2018-08-22 20:05:21 +00:00
LoopInterchange.cpp [LoopInterchange] Remove unused variable PreserveLCSSA (NFC). 2018-10-03 11:01:23 +00:00
LoopLoadElimination.cpp Use SmallPtrSet explicitly for SmallSets with pointer types (NFC). 2018-06-12 11:16:56 +00:00
LoopPassManager.cpp [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
LoopPredication.cpp [LoopPredication] add some simple stats 2018-10-17 09:02:54 +00:00
LoopRerollPass.cpp [LoopReroll] Rewrite induction variable rewriting. 2018-06-22 22:58:55 +00:00
LoopRotation.cpp Update MemorySSA in LoopRotate. 2018-10-24 22:46:45 +00:00
LoopSimplifyCFG.cpp Update MemorySSA in LoopSimplifyCFG. 2018-08-22 20:10:21 +00:00
LoopSink.cpp llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...) 2018-09-27 02:13:45 +00:00
LoopStrengthReduce.cpp Revert r345114 2018-10-24 08:41:22 +00:00
LoopUnrollAndJamPass.cpp [UnJ] Improve explicit loop count checks 2018-08-11 07:37:31 +00:00
LoopUnrollPass.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
LoopUnswitch.cpp [NFC] Make LoopSafetyInfo abstract to allow alternative implementations 2018-10-16 08:31:05 +00:00
LoopVersioningLICM.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
LowerAtomic.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
LowerExpectIntrinsic.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
LowerGuardIntrinsic.cpp Re-enable "[NFC] Unify guards detection" 2018-08-30 03:39:16 +00:00
MemCpyOptimizer.cpp Merge clang's isRepeatedBytePattern with LLVM's isBytewiseValue 2018-09-21 05:17:42 +00:00
MergeICmps.cpp Pointer types were treated as zero-size by MergeICmps 2018-10-26 18:02:06 +00:00
MergedLoadStoreMotion.cpp [STLExtras] Add size() for ranges, and remove distance() 2018-05-16 23:20:42 +00:00
NaryReassociate.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
NewGVN.cpp ADT/STLExtras: Introduce llvm::empty; NFC 2018-10-31 00:23:23 +00:00
PartiallyInlineLibCalls.cpp [PartiallyInlineLibCalls] Add DebugCounter support 2018-09-13 20:33:04 +00:00
PlaceSafepoints.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
Reassociate.cpp [FPEnv] Convert more BinaryOperator::isFNeg(...) to m_FNeg(...) 2018-10-24 14:45:18 +00:00
Reg2Mem.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
RewriteStatepointsForGC.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00
SCCP.cpp [TI removal] Rework `InstVisitor` to support visiting instructions that 2018-10-15 10:10:54 +00:00
SROA.cpp [SROA] Use offset sizes from the DataLayout instead of the pointer siezes. 2018-10-30 11:15:04 +00:00
Scalar.cpp [LLVM-C][OCaml] Add UnifyFunctionExitNodes pass to C and OCaml APIs 2018-09-18 13:36:03 +00:00
Scalarizer.cpp Fix an ordering bug in the scalarizer. 2018-10-10 09:27:45 +00:00
SeparateConstOffsetFromGEP.cpp [NFC] fix trivial typos in comments 2018-06-14 05:41:49 +00:00
SimpleLoopUnswitch.cpp Fix -Wdocumentation warning. NFCI. 2018-10-27 15:14:42 +00:00
SimplifyCFGPass.cpp Move Analysis/Utils/Local.h back to Transforms 2018-06-04 21:23:21 +00:00
Sink.cpp [IR] Replace `isa<TerminatorInst>` with `isTerminator()`. 2018-08-26 09:51:22 +00:00
SpeculateAroundPHIs.cpp fix comment typo 2018-08-27 14:25:22 +00:00
SpeculativeExecution.cpp Use SmallPtrSet explicitly for SmallSets with pointer types (NFC). 2018-06-12 11:16:56 +00:00
StraightLineStrengthReduce.cpp [SLSR] use 'match' to simplify code; NFC 2018-10-23 14:07:39 +00:00
StructurizeCFG.cpp StructurizeCFG: Simplify inserted PHI nodes 2018-10-17 15:37:41 +00:00
TailRecursionElimination.cpp [TI removal] Make variables declared as `TerminatorInst` and initialized 2018-10-15 10:04:59 +00:00