1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Transforms/Inline/inline-indirect-chain.ll
Ehud Katz 9e41c6db8c [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
2019-11-28 08:27:50 +02:00

56 lines
936 B
LLVM

; RUN: opt -inline -early-cse < %s
; This test used to crash (PR35469).
define void @func1() {
%t = bitcast void ()* @func2 to void ()*
tail call void %t()
ret void
}
define void @func2() {
%t = bitcast void ()* @func3 to void ()*
tail call void %t()
ret void
}
define void @func3() {
%t = bitcast void ()* @func4 to void ()*
tail call void %t()
ret void
}
define void @func4() {
br i1 undef, label %left, label %right
left:
%t = bitcast void ()* @func5 to void ()*
tail call void %t()
ret void
right:
ret void
}
define void @func5() {
%t = bitcast void ()* @func6 to void ()*
tail call void %t()
ret void
}
define void @func6() {
%t = bitcast void ()* @func2 to void ()*
tail call void %t()
ret void
}
define void @func7() {
%t = bitcast void ()* @func3 to void ()*
tail call void @func8(void()* %t)
ret void
}
define void @func8(void()* %f) {
tail call void %f()
ret void
}