• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -tailcallelim -S < %s 2>&1 | FileCheck %s
2
3; CHECK: add nsw i32
4; CHECK-NEXT: br label
5; CHECK: add nsw i32
6; CHECK-NEXT: br label
7; CHECK-NOT: Uses remain when a value is destroyed
8define i32 @test(i32 %n) {
9entry:
10  %cmp = icmp slt i32 %n, 2
11  br i1 %cmp, label %if.then, label %if.else
12
13if.then:                                          ; preds = %entry
14  %v1 = add nsw i32 %n, -2
15  %call1 = tail call i32 @test(i32 %v1)
16  br label %return
17
18if.else:                                          ; preds = %entry
19  %v2 = add nsw i32 %n, 4
20  %call2 = tail call i32 @test(i32 %v2)
21  br label %return
22
23return:                                           ; preds = %if.end, %if.else
24  %retval = phi i32 [ %call1, %if.then ], [ %call2, %if.else ]
25  ret i32 %retval
26}
27