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