1 ; RUN: opt -simplifycfg -S < %s | FileCheck %s 2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 3 target triple = "x86_64-unknown-linux-gnu" 4 5 ; Function Attrs: norecurse nounwind uwtable 6 define void @Test(i32* nocapture %res, i32* nocapture readnone %c, i32* nocapture readonly %d, i32* nocapture readonly %p) #0 { 7 entry: 8 br label %for.body 9 10 ; CHECK-LABEL: @Test 11 ; CHECK: load i32, i32* {{.*}}, align 4, !llvm.mem.parallel_loop_access !0 12 ; CHECK: load i32, i32* {{.*}}, align 4, !llvm.mem.parallel_loop_access !0 13 ; CHECK: store i32 {{.*}}, align 4, !llvm.mem.parallel_loop_access !0 14 ; CHECK-NOT: load 15 ; CHECK-NOT: store 16 17 for.body: ; preds = %cond.end, %entry 18 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %cond.end ] 19 %arrayidx = getelementptr inbounds i32, i32* %p, i64 %indvars.iv 20 %0 = load i32, i32* %arrayidx, align 4, !llvm.mem.parallel_loop_access !0 21 %cmp1 = icmp eq i32 %0, 0 22 br i1 %cmp1, label %cond.true, label %cond.false 23 24 cond.false: ; preds = %for.body 25 %arrayidx3 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv 26 %v = load i32, i32* %arrayidx3, align 4, !llvm.mem.parallel_loop_access !0 27 %arrayidx7 = getelementptr inbounds i32, i32* %d, i64 %indvars.iv 28 %1 = load i32, i32* %arrayidx7, align 4, !llvm.mem.parallel_loop_access !0 29 %add = add nsw i32 %1, %v 30 br label %cond.end 31 32 cond.true: ; preds = %for.body 33 %arrayidx4 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv 34 %w = load i32, i32* %arrayidx4, align 4, !llvm.mem.parallel_loop_access !0 35 %arrayidx8 = getelementptr inbounds i32, i32* %d, i64 %indvars.iv 36 %2 = load i32, i32* %arrayidx8, align 4, !llvm.mem.parallel_loop_access !0 37 %add2 = add nsw i32 %2, %w 38 br label %cond.end 39 40 cond.end: ; preds = %for.body, %cond.false 41 %cond = phi i32 [ %add, %cond.false ], [ %add2, %cond.true ] 42 %arrayidx9 = getelementptr inbounds i32, i32* %res, i64 %indvars.iv 43 store i32 %cond, i32* %arrayidx9, align 4, !llvm.mem.parallel_loop_access !0 44 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 45 %exitcond = icmp eq i64 %indvars.iv.next, 16 46 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0 47 48 for.end: ; preds = %cond.end 49 ret void 50 } 51 52 attributes #0 = { norecurse nounwind uwtable } 53 54 !0 = distinct !{!0, !1} 55 !1 = !{!"llvm.loop.vectorize.enable", i1 true} 56