1 ; RUN: opt -mtriple=thumbv7-unknown-linux-android -arm-parallel-dsp -S %s -o - | FileCheck %s
3 ; CHECK-LABEL: undef_no_return
4 ; CHECK: [[CAST_A:%[^ ]+]] = bitcast i16* %incdec.ptr21 to i32*
5 ; CHECK: [[LOAD_A:%[^ ]+]] = load i32, i32* [[CAST_A]], align 2
6 ; CHECK: %uglygep15 = getelementptr i8, i8* undef, i32 undef
7 ; CHECK: [[GEP8:%[^ ]+]] = getelementptr i8, i8* undef, i32 undef
8 ; CHECK: [[CAST_GEP8:%[^ ]+]] = bitcast i8* [[GEP8]] to i16*
9 ; CHECK: [[GEP16:%[^ ]+]] = getelementptr i16, i16* [[CAST_GEP8]], i32 6
10 ; CHECK: [[CAST_GEP16:%[^ ]+]] = bitcast i16* [[GEP16]] to i32*
11 ; CHECK: [[LOAD_UNDEF:%[^ ]+]] = load i32, i32* [[CAST_GEP16]], align 2
12 ; CHECK: call i32 @llvm.arm.smladx(i32 [[LOAD_UNDEF]], i32 [[LOAD_A]], i32 undef)
13 define void @undef_no_return(i16* %a) {
15 %incdec.ptr21 = getelementptr inbounds i16, i16* %a, i32 3
16 %incdec.ptr29 = getelementptr inbounds i16, i16* %a, i32 4
20 %0 = load i16, i16* %incdec.ptr21, align 2
21 %conv25 = sext i16 %0 to i32
22 %uglygep15 = getelementptr i8, i8* undef, i32 undef
23 %uglygep1516 = bitcast i8* %uglygep15 to i16*
24 %scevgep17 = getelementptr i16, i16* %uglygep1516, i32 7
25 %1 = load i16, i16* %scevgep17, align 2
26 %conv31 = sext i16 %1 to i32
27 %2 = load i16, i16* %incdec.ptr29, align 2
28 %conv33 = sext i16 %2 to i32
29 %uglygep12 = getelementptr i8, i8* undef, i32 undef
30 %uglygep1213 = bitcast i8* %uglygep12 to i16*
31 %scevgep14 = getelementptr i16, i16* %uglygep1213, i32 6
32 %3 = load i16, i16* %scevgep14, align 2
33 %conv39 = sext i16 %3 to i32
34 %mul.i287.neg.neg = mul nsw i32 %conv31, %conv25
35 %mul.i283.neg.neg = mul nsw i32 %conv39, %conv33
36 %reass.add408 = add i32 undef, %mul.i287.neg.neg
37 %reass.add409 = add i32 %reass.add408, %mul.i283.neg.neg
42 ; CHECK: phi i32 [ %N, %entry ]
43 ; CHECK: [[ACC:%[^ ]+]] = phi i32 [ 0, %entry ], [ [[ACC_NEXT:%[^ ]+]], %for.body ]
44 ; CHECK: [[CAST_A:%[^ ]+]] = bitcast i16* %incdec.ptr21 to i32*
45 ; CHECK: [[LOAD_A:%[^ ]+]] = load i32, i32* [[CAST_A]], align 2
46 ; CHECK: [[GEP8:%[^ ]+]] = getelementptr i8, i8* %b, i32 0
47 ; CHECK: [[CAST_GEP8:%[^ ]+]] = bitcast i8* [[GEP8]] to i16*
48 ; CHECK: [[GEP16:%[^ ]+]] = getelementptr i16, i16* [[CAST_GEP8]], i32 %iv
49 ; CHECK: [[CAST_GEP16:%[^ ]+]] = bitcast i16* [[GEP16]] to i32*
50 ; CHECK: [[LOAD_B:%[^ ]+]] = load i32, i32* [[CAST_GEP16]], align 2
51 ; CHECK: [[ACC_NEXT]] = call i32 @llvm.arm.smladx(i32 [[LOAD_B]], i32 [[LOAD_A]], i32 [[ACC]])
52 define i32 @return(i16* %a, i8* %b, i32 %N) {
54 %incdec.ptr21 = getelementptr inbounds i16, i16* %a, i32 3
55 %incdec.ptr29 = getelementptr inbounds i16, i16* %a, i32 4
59 %iv = phi i32 [ %N, %entry ], [ %iv.next, %for.body ]
60 %acc = phi i32 [ 0, %entry ], [ %reass.add409, %for.body ]
61 %0 = load i16, i16* %incdec.ptr21, align 2
62 %conv25 = sext i16 %0 to i32
63 %uglygep15 = getelementptr i8, i8* %b, i32 0
64 %uglygep1516 = bitcast i8* %uglygep15 to i16*
65 %b.idx = add nuw nsw i32 %iv, 1
66 %scevgep17 = getelementptr i16, i16* %uglygep1516, i32 %b.idx
67 %scevgep14 = getelementptr i16, i16* %uglygep1516, i32 %iv
68 %1 = load i16, i16* %scevgep17, align 2
69 %conv31 = sext i16 %1 to i32
70 %2 = load i16, i16* %incdec.ptr29, align 2
71 %conv33 = sext i16 %2 to i32
72 %3 = load i16, i16* %scevgep14, align 2
73 %conv39 = sext i16 %3 to i32
74 %mul.i287.neg.neg = mul nsw i32 %conv31, %conv25
75 %mul.i283.neg.neg = mul nsw i32 %conv39, %conv33
76 %reass.add408 = add i32 %acc, %mul.i287.neg.neg
77 %reass.add409 = add i32 %reass.add408, %mul.i283.neg.neg
78 %iv.next = add nuw nsw i32 %iv, -1
79 %cmp = icmp ne i32 %iv.next, 0
80 br i1 %cmp, label %for.body, label %exit