llvm-project/llvm/test/Transforms/Inline
Nikita Popov 4810051a82 [Inline][Cloning] Reliably remove unreachable blocks during cloning (PR53206)
The pruning cloner already tries to remove unreachable blocks. The
original cloning process will simplify instructions and constant
terminators, and only clone blocks that are reachable at that point.
However, phi nodes can only be simplified after everything has been
cloned. For that reason, additional blocks may become unreachable
after phi simplification.

The code does try to handle this as well, but only removes blocks
that don't have predecessors. It misses unreachable cycles. This
can cause issues if SEH exception handling code is part of an
unreachable cycle, as the inliner is not prepared to deal with that.

This patch instead performs an explicit scan for reachable blocks,
and drops everything else.

Fixes https://github.com/llvm/llvm-project/issues/53206.

Differential Revision: https://reviews.llvm.org/D118449
2022-01-31 09:31:34 +01:00
..
AArch64 [SVE][CodeGen] Fix InlineFunction for scalable vectors 2020-09-11 08:34:51 +01:00
AMDGPU Inliner: Correctly merge amdgpu-unsafe-fp-atomics attribute 2021-12-15 18:37:18 -05:00
ARM [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
Inputs [InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner 2021-10-29 12:32:03 -07:00
ML [MLGO] Improved support for AOT cross-targeting scenarios 2022-01-20 07:05:39 -08:00
PowerPC
WebAssembly [WebAssembly] Add missing lit.local.cfg 2020-08-13 16:33:52 -07:00
X86 [Inline][X86] Avoid inlining if it would create ABI-incompatible calls (PR52660) 2021-12-27 09:36:21 +01:00
2003-09-14-InlineValue.ll
2003-09-22-PHINodeInlineFail.ll
2003-09-22-PHINodesInExceptionDest.ll
2003-09-22-PHINodesInNormalInvokeDest.ll
2003-10-13-AllocaDominanceProblem.ll
2004-04-15-InlineDeletesCall.ll
2004-04-20-InlineLinkOnce.ll [PruneEH] Pin tests to legacy PM 2020-10-29 18:17:55 -07:00
2004-10-17-InlineFunctionWithoutReturn.ll
2006-01-14-CallGraphUpdate.ll [PruneEH] Pin tests to legacy PM 2020-10-29 18:17:55 -07:00
2006-07-12-InlinePruneCGUpdate.ll [PruneEH] Pin tests to legacy PM 2020-10-29 18:17:55 -07:00
2006-11-09-InlineCGUpdate-2.ll [PruneEH] Pin tests to legacy PM 2020-10-29 18:17:55 -07:00
2006-11-09-InlineCGUpdate.ll [PruneEH] Pin tests to legacy PM 2020-10-29 18:17:55 -07:00
2007-04-15-InlineEH.ll [Tests] Add elementtype attribute to indirect inline asm operands (NFC) 2022-01-06 14:23:51 +01:00
2007-06-25-WeakInline.ll
2007-12-19-InlineNoUnwind.ll
2008-09-02-NoInline.ll
2009-01-08-NoInlineDynamicAlloca.ll
2009-01-13-RecursiveInlineCrash.ll
2009-05-07-CallUsingSelfCrash.ll OpaquePtr: Bulk update tests to use typed sret 2020-11-20 17:58:26 -05:00
2010-05-12-ValueMap.ll
PR4909.ll
align.ll Reland [AssumeBundles] Use operand bundles to encode alignment assumptions 2020-09-12 15:36:06 +02:00
alloca-bonus.ll
alloca-dbgdeclare-merge.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
alloca-dbgdeclare.ll
alloca-in-scc.ll
alloca-merge-align.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
alloca_test.ll
always-inline-attr.ll Reapply [IR] Don't mark mustprogress as type attribute 2021-07-09 20:57:44 +02:00
always-inline-invalidate.ll [test] Make test added in D112473 check the IR 2021-10-25 14:10:58 -07:00
always-inline.ll Reland "[AlwaysInliner] Enable call site inlining to make flatten attribute working again (#53360)" 2022-01-26 01:11:06 +01:00
analysis-invalidation.ll [NewPM] Only invalidate modified functions' analyses in CGSCC passes + turn on eagerly invalidate analyses 2021-11-15 14:44:53 -08:00
arg-attr-propagation.ll [ValueTracking] Use assume's noundef operand bundle 2020-10-14 20:16:33 +09:00
array-alloca.ll
array_merge.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
attributes.ll [Inliner] Handle 'no-signed-zeros-fp-math' function attribute. 2020-06-24 17:53:59 -07:00
basictest.ll
bfi-update.ll
blockaddress.ll [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
byref-align.ll Reland [AssumeBundles] Use operand bundles to encode alignment assumptions 2020-09-12 15:36:06 +02:00
byval-align.ll Inliner: Add missing test for alignment assume with byval 2020-06-29 10:39:58 -04:00
byval-tail-call.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
byval.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
byval_lifetime.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
call-intrinsic-is-constant.ll [InlineCost] model calls to llvm.is.constant* more carefully 2021-10-08 15:27:30 -07:00
callbr.ll [llvm][test] rewrite callbr to use i rather than X constraint NFC 2022-01-11 11:31:08 -08:00
callgraph-update.ll
casts.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
cfg_preserve_test.ll
cgscc-cycle-debug.ll [LazyCallGraph] Build SCCs of the reference graph in order 2020-11-02 13:22:42 -08:00
cgscc-cycle.ll [LazyCallGraph] Build SCCs of the reference graph in order 2020-11-02 13:22:42 -08:00
cgscc-incremental-invalidate.ll [Inline] Disable deferred inlining 2021-12-16 09:59:50 +01:00
cgscc-inline-replay.ll [InlineAdvisor] Add fallback/format switches and negative remark processing to Replay Inliner 2021-10-29 12:32:03 -07:00
cgscc-invalidate.ll [LazyCallGraph] Build SCCs of the reference graph in order 2020-11-02 13:22:42 -08:00
cgscc-update.ll [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
clear-analyses.ll [NewPM] Hide pass manager debug logging behind -debug-pass-manager-verbose 2021-05-07 21:51:47 -07:00
comdat-ipo.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
crash-lifetime-marker.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
crash.ll
crash2.ll [NPM] Share pass building options with legacy PM 2020-11-23 13:04:05 -08:00
dead-calls-willreturn.ll [test] Pin dead-calls-willreturn.ll to legacy PM 2021-01-23 12:35:36 -08:00
debug-info-duplicate-calls.ll Revert "[NFC] remove explicit default value for strboolattr attribute in tests" 2021-05-24 19:43:40 +02:00
debug-invoke.ll
debuginline-cost-delta.ll [InlineCost] InlineCostAnnotationWriterPass introduced 2020-06-24 21:27:07 +00:00
delete-call.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
delete-function-with-metadata-use.ll [Inline] Attempt to delete any discardable if unused functions 2022-01-13 14:48:38 -08:00
delete-unused-function.ll [Inline] Attempt to delete any discardable if unused functions 2022-01-13 14:48:38 -08:00
deleted-scc.ll [NewPM][Inliner] Check if deleted function is in current SCC 2021-07-21 08:47:45 -07:00
deopt-bundles.ll
deoptimize-intrinsic-attrs.ll [Inliner] Copy attributes when deoptimize intrinsic is inlined 2021-05-18 10:08:37 +07:00
deoptimize-intrinsic-cconv.ll
deoptimize-intrinsic.ll
devirtualize-2.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
devirtualize-3.ll [opt] Directly translate -O# to -passes='default<O#>' 2021-10-18 16:48:10 -07:00
devirtualize-4.ll [Tests] Add elementtype attribute to indirect inline asm operands (NFC) 2022-01-06 14:23:51 +01:00
devirtualize-5.ll Reland [CGSCC] Detect devirtualization in more cases 2020-11-23 21:28:59 -08:00
devirtualize-6.ll Reland [CGSCC] Detect devirtualization in more cases 2020-11-23 21:28:59 -08:00
devirtualize.ll [Inline] prevent inlining on stack protector mismatch 2020-12-02 11:00:16 -08:00
dynamic-alloca-simplified-large.ll [IR] Make nosync, nofree and willreturn default for intrinsics. 2020-10-20 11:57:19 +02:00
dynamic_alloca_test.ll
ephemeral.ll [CodeMetrics] Don't require speculatability for ephemeral values 2021-10-21 20:30:01 +02:00
exponential-deferred-inlining.ll [Inline] Disable deferred inlining 2021-12-16 09:59:50 +01:00
externally_available.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
frameescape.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
function-count-update-2.ll
function-count-update-3.ll
function-count-update.ll
gep_from_constant.ll [InlineCost] GetElementPtr with constant operands 2020-06-25 18:09:51 +00:00
guard-intrinsic.ll
gvn-inline-iteration.ll [test] Fix gvn-inline-iteration.ll under NPM 2020-11-23 23:46:31 -08:00
ignore-debug-info.ll
inalloca-not-static.ll Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
infinite-loop-two-predecessors.ll
inline-assume.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
inline-brunch-funnel.ll
inline-byval-bonus.ll [Inline] prevent inlining on stack protector mismatch 2020-12-02 11:00:16 -08:00
inline-call-penalty-option.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-cold-callee.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-cold-callsite-pgo.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-cold-callsite.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-cold.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-constexpr-addrspacecast-argument.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
inline-cost-annotation-pass.ll [InlineCost] Add empty line between call sites when printing inline costs 2021-10-18 13:56:48 -07:00
inline-cost-attributes.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-cost-dead-users.ll [Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in inline cost model (PR51667) 2021-10-07 08:33:25 -07:00
inline-fast-math-flags.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
inline-funclets.ll
inline-hot-callee.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
inline-hot-callsite-2.ll
inline-hot-callsite.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
inline-incompat-attrs.ll [SampleFDO] Add use-sample-profile function attribute. 2020-06-02 17:23:17 -07:00
inline-indirect-chain.ll [EarlyCSE] Verify hash code in regression tests 2020-09-04 10:40:35 -04:00
inline-indirect.ll
inline-invoke-tail.ll
inline-invoke-with-asm-call.ll
inline-min-legal-vector-width.ll
inline-no-builtin-compatible.ll Revert "[TLI] Per-function fveclib for math library used for vectorization" 2020-04-11 01:05:01 +00:00
inline-optnone.ll [Inliner] Don't skip inlining alwaysinline in optnone functions 2020-07-07 12:54:55 -07:00
inline-optsize.ll
inline-probe-stack.ll
inline-ptrtoint-different-sizes.ll [test] Update PR reference in testcase [NFC] 2020-11-23 15:12:50 +01:00
inline-remark-mandatory.ll [inliner] Mandatory inlining decisions produce remarks 2021-10-05 14:01:25 -07:00
inline-remark.ll
inline-retainRV-call.ll [ObjC][ARC] Use the addresses of the ARC runtime functions instead of 2021-09-08 11:58:03 -07:00
inline-scalable.ll [InlineCost] Fix scalable vectors in visitAlloca 2020-08-17 10:34:27 +00:00
inline-semantic-interposition.ll
inline-skip-use-empty-alloca.ll
inline-stack-probe-size.ll
inline-tail.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
inline-threshold.ll [InlineCost] Introduce attributes to override InlineCost for inliner testing 2021-09-02 17:35:06 +00:00
inline-varargs.ll OpaquePtr: Bulk update tests to use typed byval 2020-11-20 14:00:46 -05:00
inline-vla.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
inline_call.ll [llvm][Inliner] Add an optional PriorityInlineOrder 2021-06-19 10:17:32 +08:00
inline_cleanup.ll
inline_constprop.ll
inline_dbg_declare.ll
inline_dce.ll
inline_inv_group.ll
inline_invoke.ll [llvm][Inliner] Add an optional PriorityInlineOrder 2021-06-19 10:17:32 +08:00
inline_minisize.ll
inline_negative_result.ll
inline_noprofile.ll [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
inline_prune.ll
inline_returns_twice.ll
inline_ssp.ll Don't override __attribute__((no_stack_protector)) by inlining (PR52886) 2022-01-13 12:04:49 +01:00
inline_stats.ll Reland "[NPM][Inliner] Factor ImportedFunctionStats in the InlineAdvisor" 2021-01-20 13:33:43 -08:00
inline_unreachable-2.ll
inline_unreachable.ll
inlined-loop-metadata-inseltpoison.ll Precommit tests that have poison as shufflevector's placeholder 2020-12-29 17:09:31 +09:00
inlined-loop-metadata.ll
inlined-mustprogress-loop-metadata.ll [Inliner] Handle `mustprogress` functions 2020-11-06 20:03:46 -05:00
inlinedefault-threshold.ll
inlining-advisor-default.ll [llvm] Development-mode InlineAdvisor 2020-07-20 11:01:56 -07:00
internal-scc-members.ll [llvm] Add interface to drive inlining decision using ML model 2020-05-13 13:27:29 -07:00
invariant-group-sroa.ll [Inliner] Propagate SROA analysis through invariant group intrinsics 2021-04-12 10:54:22 -07:00
invoke-cleanup.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
invoke-combine-clauses.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
invoke-cost.ll
invoke_test-1.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
invoke_test-2.ll [SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve DomTree 2020-12-17 01:03:49 +03:00
invoke_test-3.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
label-annotation.ll
last-call-bonus.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
last-call-no-bonus.ll [NewPM][LoopUnroll] Rename unroll* to loop-unroll* 2020-06-26 09:28:32 -07:00
last-callsite.ll [NFC][llvm] Inclusive language: reword uses of sanity test and check 2021-11-25 07:21:42 -05:00
launder.invariant.group.ll [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. 2021-01-23 12:10:57 +01:00
lifetime-no-datalayout.ll
lifetime.ll
local-as-metadata-undominated-use.ll
module-inlining.ll [llvm] Add interface to drive inlining decision using ML model 2020-05-13 13:27:29 -07:00
monster_scc.ll [NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg' 2021-07-09 09:47:03 +02:00
nested-inline.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
no-inline-line-tables.ll
no-unwind-inline-asm.ll Support unwinding from inline assembly 2021-05-13 19:13:03 +01:00
noalias-calls-always.ll [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. 2021-01-23 12:10:57 +01:00
noalias-calls.ll [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. 2021-01-23 12:10:57 +01:00
noalias-calls2.ll [Inline] Don't add noalias metadata to inaccessiblememonly calls 2021-04-17 14:56:13 +02:00
noalias-cs.ll [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. 2021-01-23 12:10:57 +01:00
noalias.ll [InlineFunction] Use llvm.experimental.noalias.scope.decl for noalias arguments. 2021-01-23 12:10:57 +01:00
noalias2.ll [Inline] Don't add noalias metadata to inaccessiblememonly calls 2021-04-17 14:56:13 +02:00
noalias3.ll [InlineFunction] Only update noalias scopes once for an instruction. 2021-02-02 17:57:10 +01:00
noduplicate.ll Fix getInlineCost with ComputeFullInlineCost enabled 2021-10-14 17:41:41 -07:00
noinline-recursive-fn.ll
noinline.ll
nonnull.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
null-function.ll [PM] Show the pass argument in pre/post-pass IR dumps 2021-02-25 14:02:00 -08:00
optimization-remarks-hotness-threshold.ll [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
optimization-remarks-passed-yaml.ll [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
optimization-remarks-with-hotness.ll [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
optimization-remarks-yaml.ll [llvm] Add interface to drive inlining decision using ML model 2020-05-13 13:27:29 -07:00
optimization-remarks.ll [InlineAdvisor] Add single quotes around caller/callee names 2021-08-10 11:51:31 -07:00
parallel-loop-md-callee.ll
parallel-loop-md-merge.ll
parallel-loop-md.ll
partial-inline-act.ll
partial-inline-incompat-attrs.ll [SampleFDO] Add use-sample-profile function attribute. 2020-06-02 17:23:17 -07:00
pr21206.ll [llvm][Inline] Add a module level inliner 2021-11-09 11:03:29 +08:00
pr22285.ll [Inliner][NPM] Fix various tests under NPM 2020-10-12 10:41:40 -07:00
pr26698.ll
pr28298.ll
pr33637.ll
pr46945.ll [NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner 2021-01-15 17:59:38 -08:00
pr48209.ll [Inline] Fix incorrect noalias metadata application (PR48209) 2020-11-18 20:52:58 +01:00
pr50270.ll [Inliner] Fix noalias metadata handling for instructions simplified during cloning (PR50270) 2021-05-10 21:59:59 +02:00
pr50589.ll [Inline] Fix noalias addition on simplified instructions (PR50589) 2021-07-20 19:52:41 +02:00
pr52118.ll [Inline] Make sure the InlineAdvisor is correctly cleared. 2021-10-12 10:42:41 -07:00
pr53206.ll [Inline][Cloning] Reliably remove unreachable blocks during cloning (PR53206) 2022-01-31 09:31:34 +01:00
prof-update-instr.ll
prof-update-sample-alwaysinline.ll Make CallInst::updateProfWeight emit i32 weights instead of i64 2020-11-24 18:13:59 -08:00
prof-update-sample.ll Make CallInst::updateProfWeight emit i32 weights instead of i64 2020-11-24 18:13:59 -08:00
profile-meta.ll
ptr-diff.ll
recursive.ll
redundant-loads.ll
ret_attr_update.ll [Attributes] Make attribute addition behavior consistent 2022-01-19 12:05:27 +01:00
simplified_to.ll [InlineCost] PrinterPass prints constants to which instructions are simplified 2020-06-24 22:52:31 +00:00
store-sroa.ll
switch.ll
unwind-inline-asm.ll Support unwinding from inline assembly 2021-05-13 19:13:03 +01:00
vector-bonus.ll
vector-no-bonus.ll
zero-cost.ll