AArch64/ARM64: move ARM64 into AArch64's place
[oota-llvm.git] / test / CodeGen / AArch64 / arm64-dagcombiner-indexed-load.ll
1 ; RUN: llc -O3 < %s | FileCheck %s
2 ; RUN: llc -O3 -addr-sink-using-gep=1 < %s | FileCheck %s
3 ; Test case for a DAG combiner bug where we combined an indexed load
4 ; with an extension (sext, zext, or any) into a regular extended load,
5 ; i.e., dropping the indexed value.
6 ; <rdar://problem/16389332>
7
8 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
9 target triple = "arm64-apple-ios"
10
11 %class.A = type { i64, i64 }
12 %class.C = type { i64 }
13
14 ; CHECK-LABEL: XX:
15 ; CHECK: ldr
16 define void @XX(%class.A* %K) {
17 entry:
18   br i1 undef, label %if.then, label %lor.rhs.i
19
20 lor.rhs.i:                                        ; preds = %entry
21   %tmp = load i32* undef, align 4
22   %y.i.i.i = getelementptr inbounds %class.A* %K, i64 0, i32 1
23   %tmp1 = load i64* %y.i.i.i, align 8
24   %U.sroa.3.8.extract.trunc.i = trunc i64 %tmp1 to i32
25   %div11.i = sdiv i32 %U.sroa.3.8.extract.trunc.i, 17
26   %add12.i = add nsw i32 0, %div11.i
27   %U.sroa.3.12.extract.shift.i = lshr i64 %tmp1, 32
28   %U.sroa.3.12.extract.trunc.i = trunc i64 %U.sroa.3.12.extract.shift.i to i32
29   %div15.i = sdiv i32 %U.sroa.3.12.extract.trunc.i, 13
30   %add16.i = add nsw i32 %add12.i, %div15.i
31   %rem.i.i = srem i32 %add16.i, %tmp
32   %idxprom = sext i32 %rem.i.i to i64
33   %arrayidx = getelementptr inbounds %class.C** undef, i64 %idxprom
34   %tobool533 = icmp eq %class.C* undef, null
35   br i1 %tobool533, label %while.end, label %while.body
36
37 if.then:                                          ; preds = %entry
38   unreachable
39
40 while.body:                                       ; preds = %lor.rhs.i
41   unreachable
42
43 while.end:                                        ; preds = %lor.rhs.i
44   %tmp3 = load %class.C** %arrayidx, align 8
45   unreachable
46 }