llvm-project/llvm/lib/Transforms/Utils
Roman Lebedev ef93f7a11c
[SimplifyCFG] FoldBranchToCommonDest: gracefully handle unreachable code ()
We might be dealing with an unreachable code,
so the bonus instruction we clone might be self-referencing.

There is a sanity check that all uses of bonus instructions
that are not in the original block with said bonus instructions
are PHI nodes, and that is obviously not the case
for self-referencing instructions..

So if we find such an use, just rewrite it.

Thanks to Mikael Holmén for the reproducer!

Fixes https://bugs.llvm.org/show_bug.cgi?id=48450#c8
2020-12-28 23:31:19 +03:00
..
AMDGPUEmitPrintf.cpp
ASanStackFrameLayout.cpp
AddDiscriminators.cpp
AssumeBundleBuilder.cpp [ValueTracking] Use assume's noundef operand bundle 2020-10-14 20:16:33 +09:00
BasicBlockUtils.cpp [RS4GC] Lazily set changed flag when folding single entry phis 2020-12-28 10:54:21 +07:00
BreakCriticalEdges.cpp [Transforms] Use llvm::is_contained (NFC) 2020-11-18 20:42:22 -08:00
BuildLibCalls.cpp [Transforms] Use llvm::append_range (NFC) 2020-12-27 09:57:29 -08:00
BypassSlowDivision.cpp
CMakeLists.txt Revert "clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM" 2020-11-14 13:12:38 +03:00
CallGraphUpdater.cpp [NewPM][CGSCC] Handle newly added functions in updateCGAndAnalysisManagerForPass 2020-09-23 15:22:18 -07:00
CallPromotionUtils.cpp [Utils] isLegalToPromote - Fix missing null check before writing to FailureReason. 2020-09-15 14:49:04 +01:00
CanonicalizeAliases.cpp
CanonicalizeFreezeInLoops.cpp [ValueTracking] Use assume's noundef operand bundle 2020-10-14 20:16:33 +09:00
CloneFunction.cpp [Transforms] Use pred_empty (NFC) 2020-11-16 22:09:14 -08:00
CloneModule.cpp
CodeExtractor.cpp Fix clang-ppc64le-rhel buildbot build error 2020-12-17 19:14:43 -08:00
CodeMoverUtils.cpp [CodeGen, Transforms] Use llvm::any_of (NFC) 2020-12-24 09:08:36 -08:00
CtorUtils.cpp
Debugify.cpp Reland "[MachineDebugify] Insert synthetic DBG_VALUE instructions" 2020-12-14 22:34:23 -05:00
DemoteRegToStack.cpp
EntryExitInstrumenter.cpp Migrate deprecated DebugLoc::get to DILocation::get 2020-12-11 12:45:22 -08:00
EscapeEnumerator.cpp [musttail] Unify musttail call preceding return checking 2020-11-03 11:39:27 -08:00
Evaluator.cpp [CodeGen, Transforms] Use *Map::lookup (NFC) 2020-12-27 09:57:27 -08:00
FixIrreducible.cpp [FixIrreducible][NewPM] Port -fix-irreducible to NPM 2020-10-09 09:22:09 -07:00
FlattenCFG.cpp
FunctionComparator.cpp Fix use-of-uninitialized-value in rG75f50e15bf8f 2020-11-26 01:39:22 -07:00
FunctionImportUtils.cpp
GlobalStatus.cpp [globalopt] Teach to look through `addrspacecast`. 2020-10-16 08:43:09 -04:00
GuardUtils.cpp
ImportedFunctionsInliningStatistics.cpp
InjectTLIMappings.cpp [NFC] Reduce include files dependency. 2020-12-03 18:25:05 +03:00
InlineFunction.cpp [Transforms] Use llvm::append_range (NFC) 2020-12-27 09:57:29 -08:00
InstructionNamer.cpp Port -instnamer to NPM 2020-10-22 12:08:36 -07:00
IntegerDivision.cpp
LCSSA.cpp [DebugInfo] Avoid re-ordering assignments in LCSSA 2020-12-17 16:17:32 +00:00
LibCallsShrinkWrap.cpp
Local.cpp [Local] Remove unused function RemovePredecessorAndSimplify (NFC) 2020-12-25 09:35:20 -08:00
LoopPeel.cpp [NFC][SCEV] Refactor monotonic predicate checks to return enums instead of bools 2020-10-29 16:01:25 +07:00
LoopRotationUtils.cpp [NFC] Reduce include files dependency and AA header cleanup (part 2). 2020-12-17 14:04:48 +03:00
LoopSimplify.cpp [SimplifyCFG] Teach FoldBranchToCommonDest() to preserve DomTree, part 1 2020-12-20 00:18:36 +03:00
LoopUnroll.cpp [Transforms] Use llvm::erase_value (NFC) 2020-12-13 09:48:47 -08:00
LoopUnrollAndJam.cpp [NFC][LoopUnrollAndJam] Use BasicBlock::replacePhiUsesWith instead of 2020-08-11 15:35:14 +00:00
LoopUnrollRuntime.cpp [NFC] Reduce include files dependency and AA header cleanup (part 2). 2020-12-17 14:04:48 +03:00
LoopUtils.cpp [SVE] Add support for scalable vectors with vectorize.scalable.enable loop attribute 2020-12-02 13:23:43 +00:00
LoopVersioning.cpp [LV] Set up branch from middle block earlier. 2020-12-27 18:21:12 +00:00
LowerInvoke.cpp
LowerMemIntrinsics.cpp
LowerSwitch.cpp [Transforms] Use llvm::erase_if (NFC) 2020-12-17 19:53:10 -08:00
MatrixUtils.cpp
Mem2Reg.cpp
MetaRenamer.cpp [MetaRenamer][NewPM] Port metarenamer to NPM 2020-10-02 15:42:25 -07:00
ModuleUtils.cpp
NameAnonGlobals.cpp
PredicateInfo.cpp
PromoteMemoryToRegister.cpp [Mem2Reg] Use llvm::count instead of std::count (NFC) 2020-11-07 20:18:47 -08:00
SSAUpdater.cpp [CodeGen, Transforms] Use *Map::lookup (NFC) 2020-12-27 09:57:27 -08:00
SSAUpdaterBulk.cpp
SanitizerStats.cpp
ScalarEvolutionExpander.cpp [SCEV] Use isa<> pattern for testing for CouldNotCompute [NFC] 2020-11-24 18:47:49 -08:00
SimplifyCFG.cpp [SimplifyCFG] FoldBranchToCommonDest: gracefully handle unreachable code () 2020-12-28 23:31:19 +03:00
SimplifyIndVar.cpp [IndVars] Fix adding trunc instructions to unwind blocks 2020-12-18 12:52:23 +07:00
SimplifyLibCalls.cpp [SimplifyLibCalls] Optimize mempcpy_chk to mempcpy 2020-10-06 17:08:46 +02:00
SizeOpts.cpp
SplitModule.cpp
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
UniqueInternalLinkageNames.cpp Prepend "__uniq" to symbol names hash with -funique-internal-linkage-names. 2020-10-26 14:24:28 -07:00
Utils.cpp [NPM] port -unify-loop-exits to NPM 2020-10-20 10:46:57 -07:00
VNCoercion.cpp [VNCoercion] Disallow coercion between different ni addrspaces 2020-12-07 20:19:48 -05:00
ValueMapper.cpp [Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper 2020-12-06 13:04:01 -08:00