Home | History | Annotate | Download | only in TailCallElim
      1 ; REQUIRES: asserts
      2 ; Duplicate the return into if.end to enable TCE.
      3 ; RUN: opt -tailcallelim -stats -disable-output < %s 2>&1 | FileCheck %s
      4 
      5 ; CHECK: Number of return duplicated
      6 
      7 define i32 @fib(i32 %n) nounwind ssp {
      8 entry:
      9   %cmp = icmp slt i32 %n, 2
     10   br i1 %cmp, label %if.then, label %if.end
     11 
     12 if.then:                                          ; preds = %entry
     13   br label %return
     14 
     15 if.end:                                           ; preds = %entry
     16   %sub = add nsw i32 %n, -2
     17   %call = call i32 @fib(i32 %sub)
     18   %sub3 = add nsw i32 %n, -1
     19   %call4 = call i32 @fib(i32 %sub3)
     20   %add = add nsw i32 %call, %call4
     21   br label %return
     22 
     23 return:                                           ; preds = %if.end, %if.then
     24   %retval.0 = phi i32 [ 1, %if.then ], [ %add, %if.end ]
     25   ret i32 %retval.0
     26 }
     27