• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=arm64-unknown-unknown -print-lsr-output < %s 2>&1 | FileCheck %s
2
3declare void @foo(i64)
4
5; Verify that redundant adds aren't inserted by LSR.
6; CHECK-LABEL: @bar(
7define void @bar(double* %A) {
8entry:
9  br label %while.cond
10
11while.cond:
12; CHECK-LABEL: while.cond:
13; CHECK: add i64 %lsr.iv, 1
14; CHECK-NOT: add i64 %lsr.iv, 1
15; CHECK-LABEL: land.rhs:
16  %indvars.iv28 = phi i64 [ %indvars.iv.next29, %land.rhs ], [ 50, %entry ]
17  %cmp = icmp sgt i64 %indvars.iv28, 0
18  br i1 %cmp, label %land.rhs, label %while.end
19
20land.rhs:
21  %indvars.iv.next29 = add nsw i64 %indvars.iv28, -1
22  %arrayidx = getelementptr inbounds double, double* %A, i64 %indvars.iv.next29
23  %Aload = load double, double* %arrayidx, align 8
24  %cmp1 = fcmp oeq double %Aload, 0.000000e+00
25  br i1 %cmp1, label %while.cond, label %if.end
26
27while.end:
28  %indvars.iv28.lcssa = phi i64 [ %indvars.iv28, %while.cond ]
29  tail call void @foo(i64 %indvars.iv28.lcssa)
30  br label %if.end
31
32if.end:
33  ret void
34}
35