brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 0ea4afb Raw
113 lines · plain
1; RUN: opt -passes='print<access-info>' -aa-pipeline='basic-aa' -disable-output < %s  2>&1 | FileCheck %s2 3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-apple-macosx10.10.0"5 6; TODO: Loop iteration counts are only required if we generate memory7;       runtime checks. Missing iteration counts should not prevent8;       analysis, if no runtime checks are required.9 10; No memory checks are required, because base pointers do not alias and we have11; a forward dependence for %a.12define void @safe_forward_dependence(ptr noalias %a,13                                     ptr noalias %b) {14; CHECK-LABEL: safe_forward_dependence15; CHECK:       for.body:16; CHECK-NEXT:     Report: could not determine number of loop iterations17;18entry:19  br label %for.body20 21for.body:                                         ; preds = %for.body, %entry22  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]23 24  %iv.next = add nuw nsw i64 %iv, 125 26  %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %iv.next27  %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 228 29  %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv30  %loadB = load i16, ptr %arrayidxB, align 231 32 33  %mul = mul i16 %loadB, %loadA_plus_234 35  %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv36  store i16 %mul, ptr %arrayidxA, align 237 38  %exitcond = icmp eq i16 %loadB, 2039  br i1 %exitcond, label %for.end, label %for.body40 41for.end:                                          ; preds = %for.body42  ret void43}44 45 46 47 48define void @unsafe_backwards_dependence(ptr noalias %a,49                                         ptr noalias %b) {50; CHECK-LABEL: unsafe_backwards_dependence51; CHECK:       for.body:52; CHECK-NEXT:     Report: could not determine number of loop iterations53;54entry:55  br label %for.body56 57for.body:                                         ; preds = %for.body, %entry58  %iv = phi i64 [ 1, %entry ], [ %iv.next, %for.body ]59 60  %idx = add nuw nsw i64 %iv, -161  %iv.next = add nuw nsw i64 %iv, 162 63  %arrayidxA_plus_2 = getelementptr inbounds i16, ptr %a, i64 %idx64  %loadA_plus_2 = load i16, ptr %arrayidxA_plus_2, align 265 66  %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv67  %loadB = load i16, ptr %arrayidxB, align 268 69 70  %mul = mul i16 %loadB, %loadA_plus_271 72  %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv73  store i16 %mul, ptr %arrayidxA, align 274 75  %exitcond = icmp eq i16 %loadB, 2076  br i1 %exitcond, label %for.end, label %for.body77 78for.end:                                          ; preds = %for.body79  ret void80}81 82 83define void @ptr_may_alias(ptr %a, ptr %b) {84; CHECK-LABEL: ptr_may_alias85; CHECK:       for.body:86; CHECK-NEXT:     Report: could not determine number of loop iterations87;88entry:89  br label %for.body90 91for.body:                                         ; preds = %for.body, %entry92  %iv = phi i64 [ 1, %entry ], [ %iv.next, %for.body ]93 94  %idx = add nuw nsw i64 %iv, -195  %iv.next = add nuw nsw i64 %iv, 196 97  %arrayidxA = getelementptr inbounds i16, ptr %a, i64 %iv98  %loadA = load i16, ptr %arrayidxA, align 299 100  %arrayidxB = getelementptr inbounds i16, ptr %b, i64 %iv101  %loadB = load i16, ptr %arrayidxB, align 2102 103  %mul = mul i16 %loadB, %loadA104 105  store i16 %mul, ptr %arrayidxA, align 2106 107  %exitcond = icmp eq i16 %loadB, 20108  br i1 %exitcond, label %for.end, label %for.body109 110for.end:                                          ; preds = %for.body111  ret void112}113