[PATCH] D104585: [NFC] Add getUnderlyingObjects test

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 16:37:05 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGac15a128d875: [NFC] Add getUnderlyingObjects test (authored by vitalybuka).

Changed prior to commit:
  https://reviews.llvm.org/D104585?vs=353146&id=353516#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104585/new/

https://reviews.llvm.org/D104585

Files:
  llvm/test/Analysis/LoopAccessAnalysis/underlying-objects-2.ll


Index: llvm/test/Analysis/LoopAccessAnalysis/underlying-objects-2.ll
===================================================================
--- llvm/test/Analysis/LoopAccessAnalysis/underlying-objects-2.ll
+++ llvm/test/Analysis/LoopAccessAnalysis/underlying-objects-2.ll
@@ -37,6 +37,7 @@
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.10.0"
 
+; CHECK-LABEL: function 'f'
 ; CHECK: for_j.body:
 ; CHECK-NEXT: Report: unsafe dependent memory operations in loop
 ; CHECK-NEXT: Dependences:
@@ -89,3 +90,64 @@
 for_i.end:
   ret void
 }
+
+; CHECK-LABEL: function 'f_deep'
+; CHECK: for_j.body:
+; FIXME: This is incorrect and is going to be fixed with D86669.
+; CHECK-NEXT: Memory dependences are safe with run-time checks
+; CHECK-NEXT: Dependences:
+
+define void @f_deep(i8** noalias %A, i8* noalias %B, i64 %N) {
+for_i.preheader:
+  %prev_0 = load i8*, i8** %A, align 8
+  br label %for_i.body
+
+for_i.body:
+  %i = phi i64 [1, %for_i.preheader], [%i.1, %for_j.end]
+  %prev = phi i8* [%prev_0, %for_i.preheader], [%curr, %for_j.end]
+  %gep = getelementptr inbounds i8*, i8** %A, i64 %i
+  %curr = load i8*, i8** %gep, align 8
+  br label %for_j.preheader
+
+for_j.preheader:
+  br label %for_j.body
+
+for_j.body:
+  %j = phi i64 [0, %for_j.preheader], [%j.1, %for_j.body]
+
+  %gepPrev = getelementptr inbounds i8, i8* %prev, i64 %j
+  %gepCurr = getelementptr inbounds i8, i8* %curr, i64 %j
+  %gepB = getelementptr inbounds i8, i8* %B, i64 %j
+  %gepB1 = getelementptr inbounds i8, i8* %gepB, i64 %j
+  %gepB2 = getelementptr inbounds i8, i8* %gepB1, i64 0
+  %gepB3 = getelementptr inbounds i8, i8* %gepB2, i64 0
+  %gepB4 = getelementptr inbounds i8, i8* %gepB3, i64 0
+  %gepB5 = getelementptr inbounds i8, i8* %gepB4, i64 0
+  %gepB6 = getelementptr inbounds i8, i8* %gepB5, i64 0
+  %gepB7 = getelementptr inbounds i8, i8* %gepB6, i64 0
+  %gepB8 = getelementptr inbounds i8, i8* %gepB7, i64 0
+  %gepB9 = getelementptr inbounds i8, i8* %gepB8, i64 0
+
+  %loadPrev = load i8, i8* %gepPrev, align 1
+  %loadB = load i8, i8* %gepB9, align 1
+
+  %mul = mul i8 %loadPrev, %loadB
+
+  store i8 %mul, i8* %gepCurr, align 1
+
+  %gepB_plus_one = getelementptr inbounds i8, i8* %gepB, i64 1
+  store i8 2, i8* %gepB_plus_one, align 1
+
+  %j.1 = add nuw i64 %j, 1
+  %exitcondj = icmp eq i64 %j.1, %N
+  br i1 %exitcondj, label %for_j.end, label %for_j.body
+
+for_j.end:
+
+  %i.1 = add nuw i64 %i, 1
+  %exitcond = icmp eq i64 %i.1, %N
+  br i1 %exitcond, label %for_i.end, label %for_i.body
+
+for_i.end:
+  ret void
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104585.353516.patch
Type: text/x-patch
Size: 2585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210621/a24f4d7b/attachment.bin>


More information about the llvm-commits mailing list