1 ; RUN: llc < %s -march=x86 -mtriple=i686-darwin | FileCheck %s 2 ; RUN: llc < %s -march=x86 -mtriple=i686-darwin -addr-sink-using-gep=1 | FileCheck %s 3 4 define void @foo(i8** %buf, i32 %size, i32 %col, i8* %p) nounwind { 5 entry: 6 ; CHECK-LABEL: @foo 7 ; CHECK: push 8 ; CHECK: push 9 ; CHECK: push 10 ; CHECK-NOT: push 11 12 icmp sgt i32 %size, 0 ; <i1>:0 [#uses=1] 13 br i1 %0, label %bb.preheader, label %return 14 15 bb.preheader: ; preds = %entry 16 %tmp5.sum72 = add i32 %col, 7 ; <i32> [#uses=1] 17 %tmp5.sum71 = add i32 %col, 5 ; <i32> [#uses=1] 18 %tmp5.sum70 = add i32 %col, 3 ; <i32> [#uses=1] 19 %tmp5.sum69 = add i32 %col, 2 ; <i32> [#uses=1] 20 %tmp5.sum68 = add i32 %col, 1 ; <i32> [#uses=1] 21 %tmp5.sum66 = add i32 %col, 4 ; <i32> [#uses=1] 22 %tmp5.sum = add i32 %col, 6 ; <i32> [#uses=1] 23 br label %bb 24 25 bb: ; preds = %bb, %bb.preheader 26 %i.073.0 = phi i32 [ 0, %bb.preheader ], [ %indvar.next, %bb ] ; <i32> [#uses=3] 27 %p_addr.076.0.rec = mul i32 %i.073.0, 9 ; <i32> [#uses=9] 28 %p_addr.076.0 = getelementptr i8, i8* %p, i32 %p_addr.076.0.rec ; <i8*> [#uses=1] 29 %tmp2 = getelementptr i8*, i8** %buf, i32 %i.073.0 ; <i8**> [#uses=1] 30 %tmp3 = load i8*, i8** %tmp2 ; <i8*> [#uses=8] 31 %tmp5 = getelementptr i8, i8* %tmp3, i32 %col ; <i8*> [#uses=1] 32 %tmp7 = load i8, i8* %p_addr.076.0 ; <i8> [#uses=1] 33 store i8 %tmp7, i8* %tmp5 34 %p_addr.076.0.sum93 = add i32 %p_addr.076.0.rec, 1 ; <i32> [#uses=1] 35 %tmp11 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum93 ; <i8*> [#uses=1] 36 %tmp13 = load i8, i8* %tmp11 ; <i8> [#uses=1] 37 %tmp15 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum72 ; <i8*> [#uses=1] 38 store i8 %tmp13, i8* %tmp15 39 %p_addr.076.0.sum92 = add i32 %p_addr.076.0.rec, 2 ; <i32> [#uses=1] 40 %tmp17 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum92 ; <i8*> [#uses=1] 41 %tmp19 = load i8, i8* %tmp17 ; <i8> [#uses=1] 42 %tmp21 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum71 ; <i8*> [#uses=1] 43 store i8 %tmp19, i8* %tmp21 44 %p_addr.076.0.sum91 = add i32 %p_addr.076.0.rec, 3 ; <i32> [#uses=1] 45 %tmp23 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum91 ; <i8*> [#uses=1] 46 %tmp25 = load i8, i8* %tmp23 ; <i8> [#uses=1] 47 %tmp27 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum70 ; <i8*> [#uses=1] 48 store i8 %tmp25, i8* %tmp27 49 %p_addr.076.0.sum90 = add i32 %p_addr.076.0.rec, 4 ; <i32> [#uses=1] 50 %tmp29 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum90 ; <i8*> [#uses=1] 51 %tmp31 = load i8, i8* %tmp29 ; <i8> [#uses=1] 52 %tmp33 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum69 ; <i8*> [#uses=2] 53 store i8 %tmp31, i8* %tmp33 54 %p_addr.076.0.sum89 = add i32 %p_addr.076.0.rec, 5 ; <i32> [#uses=1] 55 %tmp35 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum89 ; <i8*> [#uses=1] 56 %tmp37 = load i8, i8* %tmp35 ; <i8> [#uses=1] 57 %tmp39 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum68 ; <i8*> [#uses=1] 58 store i8 %tmp37, i8* %tmp39 59 %p_addr.076.0.sum88 = add i32 %p_addr.076.0.rec, 6 ; <i32> [#uses=1] 60 %tmp41 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum88 ; <i8*> [#uses=1] 61 %tmp43 = load i8, i8* %tmp41 ; <i8> [#uses=1] 62 store i8 %tmp43, i8* %tmp33 63 %p_addr.076.0.sum87 = add i32 %p_addr.076.0.rec, 7 ; <i32> [#uses=1] 64 %tmp47 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum87 ; <i8*> [#uses=1] 65 %tmp49 = load i8, i8* %tmp47 ; <i8> [#uses=1] 66 %tmp51 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum66 ; <i8*> [#uses=1] 67 store i8 %tmp49, i8* %tmp51 68 %p_addr.076.0.sum = add i32 %p_addr.076.0.rec, 8 ; <i32> [#uses=1] 69 %tmp53 = getelementptr i8, i8* %p, i32 %p_addr.076.0.sum ; <i8*> [#uses=1] 70 %tmp55 = load i8, i8* %tmp53 ; <i8> [#uses=1] 71 %tmp57 = getelementptr i8, i8* %tmp3, i32 %tmp5.sum ; <i8*> [#uses=1] 72 store i8 %tmp55, i8* %tmp57 73 %indvar.next = add i32 %i.073.0, 1 ; <i32> [#uses=2] 74 icmp eq i32 %indvar.next, %size ; <i1>:1 [#uses=1] 75 br i1 %1, label %return, label %bb 76 77 return: ; preds = %bb, %entry 78 ret void 79 } 80