llvm-project/llvm/lib/Transforms/Utils
Sidharth Baveja d81d9e8b86 [SplitEdge] Update SplitCriticalEdge to return a nullptr only when the edge is not critical
Summary:
The function SplitCriticalEdge (called by SplitEdge) can return a nullptr in
cases where the edge is a critical. SplitEdge uses SplitCriticalEdge assuming it
can always split all critical edges, which is an incorrect assumption.

The three cases where the function SplitCriticalEdge will return a nullptr is:
1. DestBB is an exception block
2. Options.IgnoreUnreachableDests is set to true and
isa(DestBB->getFirstNonPHIOrDbgOrLifetime()) is not equal to a nullptr
3. LoopSimplify form must be preserved (Options.PreserveLoopSimplify is true)
and it cannot be maintained for a loop due to indirect branches

For each of these situations they are handled in the following way:
1. Modified the function ehAwareSplitEdge originally from
llvm/lib/Transforms/Coroutines/CoroFrame.cpp to handle the cases when the DestBB
is an exception block. This function is called directly in SplitEdge.
SplitEdge does not call SplitCriticalEdge in this case
2. Options.IgnoreUnreachableDests is set to false by default, so this situation
does not apply.
3. Return a nullptr in this situation since the SplitCriticalEdge also returned
nullptr. Nothing we can do in this case.

Reviewed By: asbirlea

Differential Revision:https://reviews.llvm.org/D94619
2021-04-06 21:24:40 +00:00
..
AMDGPUEmitPrintf.cpp [OpaquePtrs] Remove some uses of type-less CreateLoad APIs (NFC) 2021-03-11 14:40:57 +01:00
ASanStackFrameLayout.cpp
AddDiscriminators.cpp
AssumeBundleBuilder.cpp Plumb AssumeInst through operand bundle apis [nfc] 2021-04-06 12:53:53 -07:00
AutoInitRemark.cpp [Remarks] Emit variable info in auto-init remarks 2021-03-04 12:51:22 -08:00
BasicBlockUtils.cpp [SplitEdge] Update SplitCriticalEdge to return a nullptr only when the edge is not critical 2021-04-06 21:24:40 +00: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 [BuildLibCalls] Add noundef to allocator fns' size 2021-02-23 13:58:03 +09:00
BypassSlowDivision.cpp
CMakeLists.txt Revert "[Passes] Add relative lookup table converter pass" 2021-03-30 14:13:37 +02:00
CallGraphUpdater.cpp [CGSCC][Coroutine][NewPM] Properly support function splitting/outlining 2021-01-06 11:19:15 -08:00
CallPromotionUtils.cpp [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-20 21:35:52 -08:00
CanonicalizeAliases.cpp
CanonicalizeFreezeInLoops.cpp [ValueTracking] Use assume's noundef operand bundle 2020-10-14 20:16:33 +09:00
CloneFunction.cpp [NFC] clang-format llvm/lib/Transforms/Utils/CloneFunction.cpp 2021-03-23 12:53:28 +00:00
CloneModule.cpp TransformUtils: Fix metadata handling in CloneModule (and improve CloneFunctionInto) 2021-02-15 11:56:00 -08:00
CodeExtractor.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
CodeMoverUtils.cpp [CodeGen, Transforms] Use llvm::any_of (NFC) 2020-12-24 09:08:36 -08:00
CtorUtils.cpp
Debugify.cpp [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
DemoteRegToStack.cpp
EntryExitInstrumenter.cpp [NFC][EntryExitInstrumenter] Mark Dominator Tree as preserved in legacy-PM too 2021-01-29 01:11:33 +03:00
EscapeEnumerator.cpp [ShadowStackGCLowering] Preserve Dominator Tree, if avaliable 2021-01-30 01:14:51 +03:00
Evaluator.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-26 22:36:40 -08:00
FixIrreducible.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
FlattenCFG.cpp
FunctionComparator.cpp Fix use-of-uninitialized-value in rG75f50e15bf8f 2020-11-26 01:39:22 -07:00
FunctionImportUtils.cpp [LTO] Perform DSOLocal propagation in combined index 2021-02-12 22:58:26 -08:00
GlobalStatus.cpp [globalopt] Teach to look through `addrspacecast`. 2020-10-16 08:43:09 -04:00
GuardUtils.cpp [llvm] Construct SmallVector with iterator ranges (NFC) 2021-01-20 21:35:52 -08:00
HelloWorld.cpp [NewPM][HelloWorld] Move HelloWorld to Utils 2021-02-03 12:59:40 -08:00
InjectTLIMappings.cpp [NFC][Analysis] Change struct VecDesc to use ElementCount 2021-02-12 11:07:58 +00:00
InlineFunction.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
InstructionNamer.cpp Port -instnamer to NPM 2020-10-22 12:08:36 -07:00
IntegerDivision.cpp
LCSSA.cpp [DebugInfo] Support DIArgList in DbgVariableIntrinsic 2021-03-08 14:36:13 +00:00
LibCallsShrinkWrap.cpp
Local.cpp Plumb AssumeInst through operand bundle apis [nfc] 2021-04-06 12:53:53 -07:00
LoopPeel.cpp [NFC] One more use case for evaluatePredicate 2021-03-18 19:21:29 +07:00
LoopRotationUtils.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
LoopSimplify.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
LoopUnroll.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
LoopUnrollAndJam.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
LoopUnrollRuntime.cpp [LoopUnrollRuntime] Add option to assume the non latch exit block to be 2021-03-03 20:43:31 +00:00
LoopUtils.cpp Avoid unused variable warning in Release builds 2021-04-06 16:25:19 +02:00
LoopVersioning.cpp Revert "[LV] Unconditionally branch from middle to scalar preheader if the scalar loop must execute" 2021-02-05 12:51:03 +01:00
LowerInvoke.cpp [Transforms/Utils] Construct SmallVector with iterator ranges (NFC) 2020-12-29 19:23:23 -08:00
LowerMemIntrinsics.cpp
LowerSwitch.cpp [Transforms] Use llvm::erase_if (NFC) 2020-12-17 19:53:10 -08:00
MatrixUtils.cpp
Mem2Reg.cpp
MetaRenamer.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-07 09:49:36 -08:00
ModuleUtils.cpp Don't use $ as suffix for symbol names in ThinLTOBitcodeWriter and other places 2021-03-29 13:03:52 +02:00
NameAnonGlobals.cpp
PredicateInfo.cpp Revert of D49126 [PredicateInfo] Use custom mangling to support ssa_copy with unnamed types. 2021-03-20 11:37:09 +01:00
PromoteMemoryToRegister.cpp Add a subclass of IntrinsicInst for llvm.assume [nfc] 2021-04-06 11:16:22 -07:00
SSAUpdater.cpp [Transforms/Utils] Use range-based for loops (NFC) 2021-02-02 22:52:47 -08:00
SSAUpdaterBulk.cpp
SampleProfileLoaderBaseUtil.cpp [SampleFDO] Third Try: Refactor SampleProfile.cpp 2021-02-17 15:31:50 -08:00
SanitizerStats.cpp
ScalarEvolutionExpander.cpp [NFCI] SCEVExpander: emit intrinsics for integral {u,s}{min,max} SCEV expressions 2021-03-06 21:52:46 +03:00
SimplifyCFG.cpp Use AssumeInst in a few more places [nfc] 2021-04-06 13:18:53 -07:00
SimplifyIndVar.cpp [IndVars] Sharpen context in eliminateIVComparison 2021-03-22 11:55:57 +07:00
SimplifyLibCalls.cpp [InstCombine][SimplifyLibCalls] An extra sqrtf was produced because of transformations in optimizePow function 2021-03-10 12:33:05 -05:00
SizeOpts.cpp
SplitModule.cpp [LTO] Update splitCodeGen to take a reference to the module. (NFC) 2021-01-29 11:53:11 +00:00
StripGCRelocates.cpp Port StripGCRelocates pass to NPM 2020-10-07 14:41:29 -07:00
StripNonLineTableDebugInfo.cpp [NPM] Port strip nonlinetable debuginfo pass to the new pass manager 2020-10-07 14:35:36 -07:00
SymbolRewriter.cpp
UnifyFunctionExitNodes.cpp [NPM] Port -mergereturn to NPM 2020-10-20 10:33:58 -07:00
UnifyLoopExits.cpp Remove unnecessary header include which violates layering 2020-10-20 20:14:03 -07:00
Utils.cpp Revert "[Passes] Add relative lookup table converter pass" 2021-03-30 14:13:37 +02:00
VNCoercion.cpp [GVN][NFC] Refactor analyzeLoadFromClobberingWrite 2021-04-01 08:35:35 +08:00
ValueMapper.cpp Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00