1; RUN: llc < %s | FileCheck %s 2 3; Check no spills to the same stack slot after hoisting. 4; CHECK: mov{{.}} %{{.*}}, [[SPOFFSET1:-?[0-9]*]](%rsp) 5; CHECK: mov{{.}} %{{.*}}, [[SPOFFSET2:-?[0-9]*]](%rsp) 6; CHECK-NOT: mov{{.}} %{{.*}}, [[SPOFFSET1]](%rsp) 7; CHECK-NOT: mov{{.}} %{{.*}}, [[SPOFFSET2]](%rsp) 8 9target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 10target triple = "x86_64-unknown-linux-gnu" 11 12@a = external global i32*, align 8 13@b = external global i32, align 4 14@d = external global i32*, align 8 15 16; Function Attrs: norecurse noreturn nounwind uwtable 17define void @fn1(i32 %p1) { 18entry: 19 %tmp = load i32*, i32** @d, align 8 20 %tmp1 = load i32*, i32** @a, align 8 21 %tmp2 = sext i32 %p1 to i64 22 br label %for.cond 23 24for.cond: ; preds = %for.inc14, %entry 25 %indvar = phi i32 [ %indvar.next, %for.inc14 ], [ 0, %entry ] 26 %indvars.iv30.in = phi i32 [ %indvars.iv30, %for.inc14 ], [ %p1, %entry ] 27 %c.0 = phi i32 [ %inc15, %for.inc14 ], [ 1, %entry ] 28 %k.0 = phi i32 [ %k.1.lcssa, %for.inc14 ], [ undef, %entry ] 29 %tmp3 = icmp sgt i32 undef, 0 30 %smax52 = select i1 %tmp3, i32 undef, i32 0 31 %tmp4 = zext i32 %smax52 to i64 32 %tmp5 = icmp sgt i64 undef, %tmp4 33 %smax53 = select i1 %tmp5, i64 undef, i64 %tmp4 34 %tmp6 = add nsw i64 %smax53, 1 35 %tmp7 = sub nsw i64 %tmp6, %tmp4 36 %tmp8 = add nsw i64 %tmp7, -8 37 %tmp9 = sub i32 undef, %indvar 38 %tmp10 = icmp sgt i64 %tmp2, 0 39 %smax40 = select i1 %tmp10, i64 %tmp2, i64 0 40 %scevgep41 = getelementptr i32, i32* %tmp1, i64 %smax40 41 %indvars.iv30 = add i32 %indvars.iv30.in, -1 42 %tmp11 = icmp sgt i32 %indvars.iv30, 0 43 %smax = select i1 %tmp11, i32 %indvars.iv30, i32 0 44 %tmp12 = zext i32 %smax to i64 45 %sub = sub nsw i32 %p1, %c.0 46 %cmp = icmp sgt i32 %sub, 0 47 %sub. = select i1 %cmp, i32 %sub, i32 0 48 %cmp326 = icmp sgt i32 %k.0, %p1 49 br i1 %cmp326, label %for.cond4.preheader, label %for.body.preheader 50 51for.cond4.preheader: ; preds = %for.body, %for.cond 52 %k.1.lcssa = phi i32 [ %k.0, %for.cond ], [ %add, %for.body ] 53 %cmp528 = icmp sgt i32 %sub., %p1 54 br i1 %cmp528, label %for.inc14, label %for.body6.preheader 55 56for.body6.preheader: ; preds = %for.cond4.preheader 57 br i1 undef, label %for.body6, label %min.iters.checked 58 59min.iters.checked: ; preds = %for.body6.preheader 60 br i1 undef, label %for.body6, label %vector.memcheck 61 62vector.memcheck: ; preds = %min.iters.checked 63 %bound1 = icmp ule i32* undef, %scevgep41 64 %memcheck.conflict = and i1 undef, %bound1 65 br i1 %memcheck.conflict, label %for.body6, label %vector.body.preheader 66 67vector.body.preheader: ; preds = %vector.memcheck 68 %lcmp.mod = icmp eq i64 undef, 0 69 br i1 %lcmp.mod, label %vector.body.preheader.split, label %vector.body.prol 70 71vector.body.prol: ; preds = %vector.body.prol, %vector.body.preheader 72 %prol.iter.cmp = icmp eq i64 undef, 0 73 br i1 %prol.iter.cmp, label %vector.body.preheader.split, label %vector.body.prol 74 75vector.body.preheader.split: ; preds = %vector.body.prol, %vector.body.preheader 76 %tmp13 = icmp ult i64 %tmp8, 24 77 br i1 %tmp13, label %middle.block, label %vector.body 78 79vector.body: ; preds = %vector.body, %vector.body.preheader.split 80 %index = phi i64 [ %index.next.3, %vector.body ], [ 0, %vector.body.preheader.split ] 81 %index.next = add i64 %index, 8 82 %offset.idx.1 = add i64 %tmp12, %index.next 83 %tmp14 = getelementptr inbounds i32, i32* %tmp, i64 %offset.idx.1 84 %tmp15 = bitcast i32* %tmp14 to <4 x i32>* 85 %wide.load.1 = load <4 x i32>, <4 x i32>* %tmp15, align 4 86 %tmp16 = getelementptr inbounds i32, i32* %tmp1, i64 %offset.idx.1 87 %tmp17 = bitcast i32* %tmp16 to <4 x i32>* 88 store <4 x i32> %wide.load.1, <4 x i32>* %tmp17, align 4 89 %index.next.3 = add i64 %index, 32 90 br i1 undef, label %middle.block, label %vector.body 91 92middle.block: ; preds = %vector.body, %vector.body.preheader.split 93 br i1 undef, label %for.inc14, label %for.body6 94 95for.body.preheader: ; preds = %for.cond 96 br label %for.body 97 98for.body: ; preds = %for.body, %for.body.preheader 99 %k.127 = phi i32 [ %k.0, %for.body.preheader ], [ %add, %for.body ] 100 %add = add nsw i32 %k.127, 1 101 %tmp18 = load i32, i32* undef, align 4 102 store i32 %tmp18, i32* @b, align 4 103 br i1 undef, label %for.body, label %for.cond4.preheader 104 105for.body6: ; preds = %for.body6, %middle.block, %vector.memcheck, %min.iters.checked, %for.body6.preheader 106 %indvars.iv32 = phi i64 [ undef, %for.body6 ], [ %tmp12, %vector.memcheck ], [ %tmp12, %min.iters.checked ], [ %tmp12, %for.body6.preheader ], [ undef, %middle.block ] 107 %arrayidx8 = getelementptr inbounds i32, i32* %tmp, i64 %indvars.iv32 108 %tmp19 = load i32, i32* %arrayidx8, align 4 109 %arrayidx10 = getelementptr inbounds i32, i32* %tmp1, i64 %indvars.iv32 110 store i32 %tmp19, i32* %arrayidx10, align 4 111 %cmp5 = icmp slt i64 %indvars.iv32, undef 112 br i1 %cmp5, label %for.body6, label %for.inc14 113 114for.inc14: ; preds = %for.body6, %middle.block, %for.cond4.preheader 115 %inc15 = add nuw nsw i32 %c.0, 1 116 %indvar.next = add i32 %indvar, 1 117 br label %for.cond 118} 119