• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=arm64-apple-ios -mcpu=cyclone < %s | FileCheck %s
2; Do not generate redundant select in early if-converstion pass.
3
4define i32 @foo(i32 %a, i32 %b)  {
5entry:
6;CHECK-LABEL: foo:
7;CHECK: csinc
8;CHECK-NOT: csel
9  %sub = sub nsw i32 %b, %a
10  %cmp10 = icmp sgt i32 %a, 0
11  br i1 %cmp10, label %while.body.lr.ph, label %while.end
12
13while.body.lr.ph:
14  br label %while.body
15
16while.body:
17  %j.012 = phi i32 [ %sub, %while.body.lr.ph ], [ %inc, %if.then ], [ %inc, %if.else ]
18  %i.011 = phi i32 [ %a, %while.body.lr.ph ], [ %inc2, %if.then ], [ %dec, %if.else ]
19  %cmp1 = icmp slt i32 %i.011, %j.012
20  br i1 %cmp1, label %while.end, label %while.cond
21
22while.cond:
23  %inc = add nsw i32 %j.012, 5
24  %cmp2 = icmp slt i32 %inc, %b
25  br i1 %cmp2, label %if.then, label %if.else
26
27if.then:
28  %inc2 = add nsw i32 %i.011, 1
29  br label %while.body
30
31if.else:
32  %dec = add nsw i32 %i.011, -1
33  br label %while.body
34
35while.end:
36  %j.0.lcssa = phi i32 [ %j.012, %while.body ], [ %sub, %entry ]
37  %i.0.lcssa = phi i32 [ %i.011, %while.body ], [ %a, %entry ]
38  %add = add nsw i32 %j.0.lcssa, %i.0.lcssa
39  ret i32 %add
40}
41
42