brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · fd886ea Raw
55 lines · plain
1; RUN: opt -passes=loop-versioning -S < %s | FileCheck %s2 3; A very simple case.  After versioning the %loadA and %loadB can't alias with4; the store.5;6; To see it easier what's going on, I expanded every noalias/scope metadata7; reference below in a comment.  For a scope I use the format scope(domain),8; e.g. scope 17 in domain 15 is written as 17(15).9 10; CHECK-LABEL: @f(11 12target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"13 14define void @f(ptr %a, ptr %b, ptr %c) {15entry:16  br label %for.body17 18; CHECK: for.body.lver.orig:19; CHECK: for.body:20for.body:                                         ; preds = %for.body, %entry21  %ind = phi i64 [ 0, %entry ], [ %add, %for.body ]22 23  %arrayidxA = getelementptr inbounds i32, ptr %a, i64 %ind24; CHECK: %loadA = {{.*}} !alias.scope !025; A's scope: !0 -> { 1(2) }26  %loadA = load i32, ptr %arrayidxA, align 427 28  %arrayidxB = getelementptr inbounds i32, ptr %b, i64 %ind29; CHECK: %loadB = {{.*}} !alias.scope !330; B's scope: !3 -> { 4(2) }31  %loadB = load i32, ptr %arrayidxB, align 432 33  %mulC = mul i32 %loadA, %loadB34 35  %arrayidxC = getelementptr inbounds i32, ptr %c, i64 %ind36; CHECK: store {{.*}} !alias.scope !5, !noalias !737; C noalias A and B: !7 -> { 1(2), 4(2) }38  store i32 %mulC, ptr %arrayidxC, align 439 40  %add = add nuw nsw i64 %ind, 141  %exitcond = icmp eq i64 %add, 2042  br i1 %exitcond, label %for.end, label %for.body43 44for.end:                                          ; preds = %for.body45  ret void46}47; CHECK: !0 = !{!1}48; CHECK: !1 = distinct !{!1, !2}49; CHECK: !2 = distinct !{!2, !"LVerDomain"}50; CHECK: !3 = !{!4}51; CHECK: !4 = distinct !{!4, !2}52; CHECK: !5 = !{!6}53; CHECK: !6 = distinct !{!6, !2}54; CHECK: !7 = !{!1, !4}55