Merging r258471:
[oota-llvm.git] / test / CodeGen / AArch64 / arm64-2011-10-18-LdStOptBug.ll
1 ; RUN: llc < %s -mtriple=arm64-apple-ios | FileCheck %s
2
3 ; Can't fold the increment by 1<<12 into a post-increment load
4 ; rdar://10301335
5
6 @test_data = common global i32 0, align 4
7
8 define void @t() nounwind ssp {
9 ; CHECK-LABEL: t:
10 entry:
11   br label %for.body
12
13 for.body:
14 ; CHECK: for.body
15 ; CHECK: ldr w{{[0-9]+}}, [x{{[0-9]+}}, x{{[0-9]+}}]
16 ; CHECK: add x[[REG:[0-9]+]],
17 ; CHECK:                      x[[REG]], #1, lsl  #12
18   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
19   %0 = shl nsw i64 %indvars.iv, 12
20   %add = add nsw i64 %0, 34628173824
21   %1 = inttoptr i64 %add to i32*
22   %2 = load volatile i32, i32* %1, align 4096
23   store volatile i32 %2, i32* @test_data, align 4
24   %indvars.iv.next = add i64 %indvars.iv, 1
25   %lftr.wideiv = trunc i64 %indvars.iv.next to i32
26   %exitcond = icmp eq i32 %lftr.wideiv, 200
27   br i1 %exitcond, label %for.end, label %for.body
28
29 for.end:
30   ret void
31 }