HomePhabricator

[FuncAttrs] Infer noreturn

Authored by aeubanks on Dec 29 2020, 10:58 PM.

Description

[FuncAttrs] Infer noreturn

A function is noreturn if all blocks terminating with a ReturnInst
contain a call to a noreturn function. Skip looking at naked functions
since there may be asm that returns.

This can be further refined in the future by checking unreachable blocks
and taking into account recursion. It looks like the attributor pass
does this, but that is not yet enabled by default.

This seems to help with code size under the new PM since PruneEH does
not run under the new PM, missing opportunities to mark some functions
noreturn, which in turn doesn't allow simplifycfg to clean up dead code.
https://bugs.llvm.org/show_bug.cgi?id=46858.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D93946

Details

Committed
aeubanksJan 5 2021, 1:25 PM
Reviewer
rnk
Differential Revision
D93946: [FuncAttrs] Infer noreturn
Parents
rG90b8fd613607: scudo: Fix compilation for non-Linux aarch64
Branches
Unknown
Tags
Unknown