[all-commits] [llvm/llvm-project] 8cf1cc: [FuncAttrs] Infer noreturn

aeubanks via All-commits all-commits at lists.llvm.org
Tue Jan 5 13:31:26 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8cf1cc578d3288f5b9cfe1584e524f8b1517dc97
      https://github.com/llvm/llvm-project/commit/8cf1cc578d3288f5b9cfe1584e524f8b1517dc97
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2021-01-05 (Tue, 05 Jan 2021)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    A llvm/test/Transforms/FunctionAttrs/noreturn.ll
    M llvm/test/Transforms/PruneEH/simplenoreturntest.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list