[FunctionAttrs] Derive willreturn for fns with readonly` & `mustprogress`.
authorFlorian Hahn <flo@fhahn.com>
Tue, 12 Jan 2021 19:55:17 +0000 (19:55 +0000)
committerFlorian Hahn <flo@fhahn.com>
Tue, 12 Jan 2021 20:02:34 +0000 (20:02 +0000)
commit6cd44b204c6c6f2e915270af6792f247c4c23abc
tree23ff946c5ba55a30123d22b74f62769214d0f2d6
parente5f51fdd650c6d20c81fedb8e856e9858aa10991
[FunctionAttrs] Derive willreturn for fns with readonly` & `mustprogress`.

Similar to D94125, derive `willreturn` for functions that are `readonly` and
`mustprogress` in FunctionAttrs.

To quote the reasoning from D94125:

    Since D86233 we have `mustprogress` which, in combination with
    `readonly`, implies `willreturn`. The idea is that every side-effect
    has to be modeled as a "write". Consequently, `readonly` means there
    is no side-effect, and `mustprogress` guarantees that we cannot "loop"
    forever without side-effect.

Reviewed By: jdoerfert, nikic

Differential Revision: https://reviews.llvm.org/D94502
llvm/include/llvm/IR/Function.h
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/test/Transforms/FunctionAttrs/willreturn.ll