[PATCH] D96949: [FuncAttrs] Add willreturn to readonly callsites in mustprogress fns.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 18 04:25:46 PST 2021


fhahn created this revision.
fhahn added reviewers: efriedma, jdoerfert, nikic, jeroen.dobbelaere.
Herald added subscribers: dexonsmith, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.

willreturn is now required by a number of passes in order to remove
function calls. Currently we fail to eliminate readonly function calls
in mustprogress functions, because we do not combine the mustprogress
info of the containing function with the readonly info at call sites.

This can lead to situations where calls that are guaranteed to return
are not eliminated from C++ code, as discussed on llvm-dev.
(https://lists.llvm.org/pipermail/llvm-dev/2021-February/148596.html)

This patch updates FunctionAttrs to add willreturn to readonly call
sites in mustprogress functions or willreturn function. This also allows
adding willreturn to the containing function, if all function calls can
be marked as willreturn.

Markgin callsites in a willreturn function as willreturn, can also be
helpful in the presence of inlining. There is a potentialcyclic dependency
between adding willreturn to functions and callsites in a function:
adding willreturn to callsites first enables adding willreturn to the
function in some cases. But adding willreturn to a function first
enables adding willreturn to more callsites.

For now, add it to callsites first.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96949

Files:
  llvm/include/llvm/IR/InstrTypes.h
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Transforms/FunctionAttrs/willreturn-callsites.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96949.324597.patch
Type: text/x-patch
Size: 5202 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/441d63de/attachment.bin>


More information about the llvm-commits mailing list