Displaying 1 result from an estimated 1 matches for "_z9fibj".
2014 May 08
3
[LLVMdev] Small problem with the tail call elimination pass
...ementation into efficient code”
However, I don’t see this behavior when trying to compile this variant of
the mentioned “typical naive fib implementation”:
unsigned int fib(unsigned int n) {
return n < 2 ? n : fib(n-1) + fib(n-2);
}
The IR with clang -O3 (version 3.4) is this:
define i32 @_Z9fibj(i32 %n) #0 {
%1 = icmp ult i32 %n, 2
br i1 %1, label %8, label %2
; <label>:2 ; preds = %0
%3 = add i32 %n, -1
%4 = tail call i32 @_Z9fibj(i32 %3)
%5 = add i32 %n, -2
%6 = tail call i32 @_Z9fibj(i32 %5)
%7 = add i32 %6, %4
ret i32 %7
; &...