llvm-project/llvm/lib/Transforms/Utils
Florian Hahn 2ead34716a
[SimplifyCFG] Add early bailout if Use is not in same BB.
Without this patch, passingValueIsAlwaysUndefined will iterate over all
instructions from I to the end of the basic block, even if the use is
outside the block.

This patch adds an early bail out, if the use instruction is outside I's
BB. This can greatly reduce compile-time in cases where very large basic
blocks are involved, with a large number of PHI nodes and incoming
values.

Note that the refactoring makes the handling of the case where I is a
phi and Use is in PHI more explicit  as well: for phi nodes, we can also
directly bail out. In the existing code, we would iterate until we reach
the end and return false.

Based on an earlier patch by Matt Wala.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D113293
2021-11-09 12:57:03 +00:00
..
AMDGPUEmitPrintf.cpp [AMDGPU] Correction to 095c48fdf3. 2021-10-05 21:47:25 -04:00
ASanStackFrameLayout.cpp More size_t -> uint64_t fixes after 05392466 2021-10-06 15:13:47 -07:00
AddDiscriminators.cpp [SampleFDO] Place the discriminator flag variable into the used list. 2021-06-15 21:51:04 -07:00
AssumeBundleBuilder.cpp Make various assume bundle data structures use uint64_t 2021-10-13 10:38:41 -07:00
BasicBlockUtils.cpp [LoopPeel] Peel loops with exits followed by an unreachable or deopt block 2021-11-02 23:12:04 +07:00
BreakCriticalEdges.cpp [SplitEdge] Update SplitCriticalEdge to return a nullptr only when the edge is not critical 2021-04-06 21:24:40 +00:00
BuildLibCalls.cpp Fixed more warnings in LLVM produced by -Wbitwise-instead-of-logical 2021-10-03 13:58:10 +02:00
BypassSlowDivision.cpp
CMakeLists.txt [Remarks] Add analysis remarks for memset/memcpy/memmove lengths 2021-05-24 10:10:44 -07:00
CallGraphUpdater.cpp
CallPromotionUtils.cpp [CallPromotion] Check for inalloca/byval mismatch 2021-08-13 16:52:04 -07:00
CanonicalizeAliases.cpp
CanonicalizeFreezeInLoops.cpp [CanonicalizeFreeze] Drop IVUsers.h include (NFC) 2021-10-09 17:01:26 +02:00
CloneFunction.cpp [CSSPGO] Unblock optimizations with pseudo probe instrumentation part 3. 2021-10-12 09:44:12 -07:00
CloneModule.cpp
CodeExtractor.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-07 17:03:15 -08:00
CodeMoverUtils.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-02 18:13:23 -07:00
CtorUtils.cpp
Debugify.cpp NFC: [Debugify] Fix a typo when checking variables in the original mode 2021-09-29 04:35:10 -07:00
DemoteRegToStack.cpp
EntryExitInstrumenter.cpp [NPM] Added -print-pipeline-passes print params for a few passes. 2021-09-15 08:34:04 +02:00
EscapeEnumerator.cpp
Evaluator.cpp [Transforms] Migrate from getNumArgOperands to arg_size (NFC) 2021-10-01 09:57:40 -07:00
FixIrreducible.cpp [Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC) 2021-10-31 07:57:32 -07:00
FlattenCFG.cpp [Transforms] Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC) 2021-10-31 07:57:32 -07:00
FunctionComparator.cpp [NFC][AttributeList] Replace index_begin/end with an iterator 2021-10-01 10:17:41 -07:00
FunctionImportUtils.cpp [ThinLTO] Respect ClearDSOLocalOnDeclarations for unimported functions 2021-07-02 17:08:25 -07:00
GlobalStatus.cpp Reapply "[GlobalOpt][FIX] Do not embed initializers into AS!=0 globals"" 2021-09-10 15:22:56 -05:00
GuardUtils.cpp
HelloWorld.cpp
InjectTLIMappings.cpp [Transforms] Migrate from getNumArgOperands to arg_size (NFC) 2021-10-01 09:57:40 -07:00
InlineFunction.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-07 17:03:15 -08:00
InstructionNamer.cpp
IntegerDivision.cpp
LCSSA.cpp Fix typo s/beloinging/belonging 2021-08-31 12:01:50 +05:30
LibCallsShrinkWrap.cpp [IR, Transforms] Use arg_empty (NFC) 2021-09-09 08:50:10 -07:00
Local.cpp Revert "Revert "Recommit "Revert "[CVP] processSwitch: Remove default case when switch cover all possible values."""" 2021-11-01 15:31:59 +08:00
LoopPeel.cpp [NFC] Get rid of hardcoded magical constant and use Optionals instead 2021-11-09 18:13:19 +07:00
LoopRotationUtils.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-07 17:03:15 -08:00
LoopSimplify.cpp [MemorySSA] Remove -enable-mssa-loop-dependency option 2021-08-16 20:59:37 +02:00
LoopUnroll.cpp [Utils] Use make_early_inc_range (NFC) 2021-09-13 08:57:23 -07:00
LoopUnrollAndJam.cpp [LoopUnroll] Push runtime unrolling decision up into tryToUnrollLoop() 2021-06-19 09:25:57 +02:00
LoopUnrollRuntime.cpp [llvm] Use llvm::is_contained (NFC) 2021-10-14 22:44:09 -07:00
LoopUtils.cpp [Transforms] Use make_early_inc_range (NFC) 2021-11-07 17:03:15 -08:00
LoopVersioning.cpp [LoopUtils] Simplify addRuntimeCheck to return a single value. 2021-10-18 18:03:09 +01:00
LowerInvoke.cpp
LowerMemIntrinsics.cpp [LowerMemIntrinsics] Typo fix. 2021-08-08 22:38:58 -04:00
LowerSwitch.cpp [Transforms] Use make_early_inc_range (NFC) 2021-09-15 19:55:24 -07:00
MatrixUtils.cpp
Mem2Reg.cpp
MemoryOpRemark.cpp [NFC][OpaquePtr] Use GlobalValue::getValueType() more 2021-07-09 09:55:41 -07:00
MetaRenamer.cpp
ModuleUtils.cpp [IR, Transforms] Use arg_empty (NFC) 2021-09-09 08:50:10 -07:00
NameAnonGlobals.cpp
PredicateInfo.cpp [PredicateInfo] Use Intrinsic::getDeclaration now that it handles unnamed types. 2021-07-28 19:30:29 +02:00
PromoteMemoryToRegister.cpp [SROA] Support opaque pointers 2021-09-08 22:25:44 +02:00
RelLookupTableConverter.cpp [Utils] Use make_early_inc_range (NFC) 2021-09-13 08:57:23 -07:00
SCCPSolver.cpp [SCCP] Tune cast instruction handling for overdefined operand 2021-11-08 18:34:30 +03:00
SSAUpdater.cpp
SSAUpdaterBulk.cpp [Transforms] Remove HasValueForBlock (NFC) 2021-07-30 08:56:49 -07:00
SampleProfileLoaderBaseUtil.cpp [SampleFDO] Place the discriminator flag variable into the used list. 2021-06-15 21:51:04 -07:00
SanitizerStats.cpp
ScalarEvolutionExpander.cpp [SCEVExpander] Use stable_sort to sort loop Phis in SCEVExpander::replaceCongruentIVs 2021-11-09 16:29:57 +07:00
SimplifyCFG.cpp [SimplifyCFG] Add early bailout if Use is not in same BB. 2021-11-09 12:57:03 +00:00
SimplifyIndVar.cpp Put implementation details into anonymous namespaces. NFCI. 2021-11-07 15:18:30 +01:00
SimplifyLibCalls.cpp [Target, Transforms] Use StringRef::contains (NFC) 2021-10-22 08:52:33 -07:00
SizeOpts.cpp Internalize some cl::opt global variables or move them under namespace llvm 2021-05-07 11:15:43 -07:00
SplitModule.cpp [IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol 2021-10-20 10:29:47 -07:00
StripGCRelocates.cpp
StripNonLineTableDebugInfo.cpp
SymbolRewriter.cpp [llvm] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine) 2021-10-06 12:04:30 +01:00
UnifyFunctionExitNodes.cpp
UnifyLoopExits.cpp
Utils.cpp Revert "[Passes] Add relative lookup table converter pass" 2021-03-30 14:13:37 +02:00
VNCoercion.cpp [ConstantFolding] Accept offset in ConstantFoldLoadFromConstPtr (NFCI) 2021-10-23 17:59:39 +02:00
ValueMapper.cpp [IR] Refactor GlobalIFunc to inherit from GlobalObject, Remove GlobalIndirectSymbol 2021-10-20 10:29:47 -07:00