[PATCH] D93946: [FuncAttrs] Infer noreturn

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 30 07:02:08 PST 2020


aeubanks created this revision.
aeubanks added reviewers: SjoerdMeijer, fhahn, jdoerfert.
Herald added subscribers: uenoku, hiraditya.
Herald added a reviewer: uenoku.
aeubanks requested review of this revision.
Herald added a reviewer: sstefan1.
Herald added a reviewer: baziotis.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93946

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Transforms/FunctionAttrs/noreturn.ll
  llvm/test/Transforms/PruneEH/simplenoreturntest.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93946.314119.patch
Type: text/x-patch
Size: 3868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201230/94cc4710/attachment.bin>


More information about the llvm-commits mailing list