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