[llvm] 072ddff - [BasicAA] Add recphi test with dynamic offset (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 21 08:52:23 PST 2020


Author: Nikita Popov
Date: 2020-11-21T17:37:41+01:00
New Revision: 072ddff3f20787fd82ed8ee7f019db5f594b8a08

URL: https://github.com/llvm/llvm-project/commit/072ddff3f20787fd82ed8ee7f019db5f594b8a08
DIFF: https://github.com/llvm/llvm-project/commit/072ddff3f20787fd82ed8ee7f019db5f594b8a08.diff

LOG: [BasicAA] Add recphi test with dynamic offset (NFC)

Currently, we don't recognize that %a an %p don't alias.

Added: 
    

Modified: 
    llvm/test/Analysis/BasicAA/recphi.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/BasicAA/recphi.ll b/llvm/test/Analysis/BasicAA/recphi.ll
index f0ddb8c94751..26114fc60e1c 100644
--- a/llvm/test/Analysis/BasicAA/recphi.ll
+++ b/llvm/test/Analysis/BasicAA/recphi.ll
@@ -188,6 +188,28 @@ bb5:                                              ; preds = %bb3, %bb4
   ret i16 0
 }
 
+; CHECK-LABEL: Function: dynamic_offset
+; CHECK: NoAlias:  i8* %a, i8* %p.base
+; CHECK: MayAlias: i8* %p, i8* %p.base
+; CHECK: MayAlias: i8* %a, i8* %p
+; CHECK: MayAlias: i8* %p.base, i8* %p.next
+; CHECK: MayAlias: i8* %a, i8* %p.next
+; CHECK: MayAlias: i8* %p, i8* %p.next
+define void @dynamic_offset(i1 %c, i8* noalias %p.base) {
+entry:
+  %a = alloca i8
+  br label %loop
+
+loop:
+  %p = phi i8* [ %p.base, %entry ], [ %p.next, %loop ]
+  %offset = call i16 @call(i32 0)
+  %p.next = getelementptr inbounds i8, i8* %p, i16 %offset
+  br i1 %c, label %loop, label %exit
+
+exit:
+  ret void
+}
+
 ; TODO: Currently yields an asymmetric result.
 ; CHECK-LABEL: Function: symmetry
 ; CHECK: MayAlias:  i32* %p, i32* %p.base


        


More information about the llvm-commits mailing list