[llvm] [CodeExtractor] Terminate callsite blocks to new `noreturn` functions with `unreachable` (PR #84682)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 18:18:12 PDT 2024
================
@@ -1895,16 +1911,6 @@ CodeExtractor::extractCodeRegion(const CodeExtractorAnalysisCache &CEAC,
fixupDebugInfoPostExtraction(*oldFunction, *newFunction, *TheCall);
- // Mark the new function `noreturn` if applicable. Terminators which resume
- // exception propagation are treated as returning instructions. This is to
- // avoid inserting traps after calls to outlined functions which unwind.
- bool doesNotReturn = none_of(*newFunction, [](const BasicBlock &BB) {
- const Instruction *Term = BB.getTerminator();
- return isa<ReturnInst>(Term) || isa<ResumeInst>(Term);
- });
- if (doesNotReturn)
- newFunction->setDoesNotReturn();
-
LLVM_DEBUG(if (verifyFunction(*newFunction, &errs())) {
----------------
goldsteinn wrote:
NB the comment around when `HotColdSplitting` is enabled:
```
// Split out cold code. Splitting is done late to avoid hiding context from
// other optimizations and inadvertently regressing performance. The tradeoff
// is that this has a higher code size cost than splitting early.
```
https://github.com/llvm/llvm-project/pull/84682
More information about the llvm-commits
mailing list