1; RUN: opt < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=4 -dce -instcombine -S | FileCheck %s 2 3target 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" 4target triple = "x86_64-unknown-linux-gnu" 5 6; The parallel loop has been invalidated by the new memory accesses introduced 7; by reg2mem (Loop::isParallel() starts to return false). Ensure the loop is 8; now non-vectorizable. 9 10;CHECK-NOT: <4 x i32> 11define void @parallel_loop(i32* nocapture %a, i32* nocapture %b) nounwind uwtable { 12entry: 13 %indvars.iv.next.reg2mem = alloca i64 14 %indvars.iv.reg2mem = alloca i64 15 %"reg2mem alloca point" = bitcast i32 0 to i32 16 store i64 0, i64* %indvars.iv.reg2mem 17 br label %for.body 18 19for.body: ; preds = %for.body.for.body_crit_edge, %entry 20 %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem 21 %arrayidx = getelementptr inbounds i32, i32* %b, i64 %indvars.iv.reload 22 %0 = load i32, i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !3 23 %arrayidx2 = getelementptr inbounds i32, i32* %a, i64 %indvars.iv.reload 24 %1 = load i32, i32* %arrayidx2, align 4, !llvm.mem.parallel_loop_access !3 25 %idxprom3 = sext i32 %1 to i64 26 %arrayidx4 = getelementptr inbounds i32, i32* %a, i64 %idxprom3 27 store i32 %0, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !3 28 %indvars.iv.next = add i64 %indvars.iv.reload, 1 29 ; A new store without the parallel metadata here: 30 store i64 %indvars.iv.next, i64* %indvars.iv.next.reg2mem 31 %indvars.iv.next.reload1 = load i64, i64* %indvars.iv.next.reg2mem 32 %arrayidx6 = getelementptr inbounds i32, i32* %b, i64 %indvars.iv.next.reload1 33 %2 = load i32, i32* %arrayidx6, align 4, !llvm.mem.parallel_loop_access !3 34 store i32 %2, i32* %arrayidx2, align 4, !llvm.mem.parallel_loop_access !3 35 %indvars.iv.next.reload = load i64, i64* %indvars.iv.next.reg2mem 36 %lftr.wideiv = trunc i64 %indvars.iv.next.reload to i32 37 %exitcond = icmp eq i32 %lftr.wideiv, 512 38 br i1 %exitcond, label %for.end, label %for.body.for.body_crit_edge, !llvm.loop !3 39 40for.body.for.body_crit_edge: ; preds = %for.body 41 %indvars.iv.next.reload2 = load i64, i64* %indvars.iv.next.reg2mem 42 store i64 %indvars.iv.next.reload2, i64* %indvars.iv.reg2mem 43 br label %for.body 44 45for.end: ; preds = %for.body 46 ret void 47} 48 49!3 = !{!3} 50