1 ; RUN: llc < %s | FileCheck %s
3 ; Test LSR's ability to prune formulae that refer to nonexistant
4 ; AddRecs in other loops.
6 ; Unable to reduce this case further because it requires LSR to exceed
9 ; We really just want to ensure that LSR can process this loop without
10 ; finding an unsatisfactory solution and bailing out. I've added
11 ; dummyout, an obvious candidate for postinc replacement so we can
12 ; verify that LSR removes it.
14 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
15 target triple = "x86_64-apple-darwin"
18 ; CHECK: # %for.body{{$}}
19 ; dummyiv copy should be removed
21 ; CHECK: # %for.cond19.preheader
22 ; dummycnt should be removed
24 ; CHECK: # %for.body23{{$}}
25 define i64 @test(i64 %count, float* nocapture %srcrow, i32* nocapture %destrow) nounwind uwtable ssp {
27 %cmp34 = icmp eq i64 %count, 0
28 br i1 %cmp34, label %for.end29, label %for.body
30 for.body: ; preds = %entry, %for.body
31 %dummyiv = phi i64 [ %dummycnt, %for.body ], [ 0, %entry ]
32 %indvars.iv39 = phi i64 [ %indvars.iv.next40, %for.body ], [ 0, %entry ]
33 %dp.036 = phi i32* [ %add.ptr, %for.body ], [ %destrow, %entry ]
34 %p.035 = phi float* [ %incdec.ptr4, %for.body ], [ %srcrow, %entry ]
35 %incdec.ptr = getelementptr inbounds float* %p.035, i64 1
36 %0 = load float* %incdec.ptr, align 4
37 %incdec.ptr2 = getelementptr inbounds float* %p.035, i64 2
38 %1 = load float* %incdec.ptr2, align 4
39 %incdec.ptr3 = getelementptr inbounds float* %p.035, i64 3
40 %2 = load float* %incdec.ptr3, align 4
41 %incdec.ptr4 = getelementptr inbounds float* %p.035, i64 4
42 %3 = load float* %incdec.ptr4, align 4
43 %4 = load i32* %dp.036, align 4
44 %conv5 = fptoui float %0 to i32
45 %or = or i32 %4, %conv5
46 %arrayidx6 = getelementptr inbounds i32* %dp.036, i64 1
47 %5 = load i32* %arrayidx6, align 4
48 %conv7 = fptoui float %1 to i32
49 %or8 = or i32 %5, %conv7
50 %arrayidx9 = getelementptr inbounds i32* %dp.036, i64 2
51 %6 = load i32* %arrayidx9, align 4
52 %conv10 = fptoui float %2 to i32
53 %or11 = or i32 %6, %conv10
54 %arrayidx12 = getelementptr inbounds i32* %dp.036, i64 3
55 %7 = load i32* %arrayidx12, align 4
56 %conv13 = fptoui float %3 to i32
57 %or14 = or i32 %7, %conv13
58 store i32 %or, i32* %dp.036, align 4
59 store i32 %or8, i32* %arrayidx6, align 4
60 store i32 %or11, i32* %arrayidx9, align 4
61 store i32 %or14, i32* %arrayidx12, align 4
62 %add.ptr = getelementptr inbounds i32* %dp.036, i64 4
63 %indvars.iv.next40 = add i64 %indvars.iv39, 4
64 %dummycnt = add i64 %dummyiv, 1
65 %cmp = icmp ult i64 %indvars.iv.next40, %count
66 br i1 %cmp, label %for.body, label %for.cond19.preheader
68 for.cond19.preheader: ; preds = %for.body
69 %dummyout = add i64 %dummyiv, 1
70 %rem = and i64 %count, 3
71 %cmp2130 = icmp eq i64 %rem, 0
72 br i1 %cmp2130, label %for.end29, label %for.body23.lr.ph
74 for.body23.lr.ph: ; preds = %for.cond19.preheader
75 %8 = and i64 %count, 3
78 for.body23: ; preds = %for.body23, %for.body23.lr.ph
79 %indvars.iv = phi i64 [ 0, %for.body23.lr.ph ], [ %indvars.iv.next, %for.body23 ]
80 %dp.132 = phi i32* [ %add.ptr, %for.body23.lr.ph ], [ %incdec.ptr28, %for.body23 ]
81 %p.131 = phi float* [ %incdec.ptr4, %for.body23.lr.ph ], [ %incdec.ptr24, %for.body23 ]
82 %incdec.ptr24 = getelementptr inbounds float* %p.131, i64 1
83 %9 = load float* %incdec.ptr24, align 4
84 %10 = load i32* %dp.132, align 4
85 %conv25 = fptoui float %9 to i32
86 %or26 = or i32 %10, %conv25
87 store i32 %or26, i32* %dp.132, align 4
88 %indvars.iv.next = add i64 %indvars.iv, 1
89 %incdec.ptr28 = getelementptr inbounds i32* %dp.132, i64 1
90 %exitcond = icmp eq i64 %indvars.iv.next, %8
91 br i1 %exitcond, label %for.end29, label %for.body23
93 for.end29: ; preds = %entry, %for.body23, %for.cond19.preheader
94 %result = phi i64 [ 0, %entry ], [ %dummyout, %for.body23 ], [ %dummyout, %for.cond19.preheader ]