[InlineCost] Fix infinite loop in indirect call evaluation
authorEhud Katz <ehudkatz@gmail.com>
Thu, 28 Nov 2019 06:27:50 +0000 (08:27 +0200)
committerEhud Katz <ehudkatz@gmail.com>
Thu, 28 Nov 2019 06:27:50 +0000 (08:27 +0200)
commit825debe847d15a5670eff54745a6691145ddfae1
treebc5bb46e4bfd34e808dcf988506aa8f7522ff064
parent735f4793f13d799a1ad480192567a62cc8158bf1
[InlineCost] Fix infinite loop in indirect call evaluation

Currently every time we encounter an indirect call of a known function,
we try to evaluate the inline cost of that function. In case of a
recursion, that evaluation never stops.

The solution I propose is to evaluate only the indirect call of the
function, while any further indirect calls (of a known function) will be
treated just as direct function calls, which, actually, never tries to
evaluate the call.

Fixes PR35469.

Differential Revision: https://reviews.llvm.org/D69349
llvm/lib/Analysis/InlineCost.cpp
llvm/test/Transforms/Inline/inline-indirect-chain.ll [new file with mode: 0644]