Skip to content

Commit

Permalink
[BasicAA] Convert some tests to opaque pointers (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Dec 16, 2022
1 parent eafe2d4 commit 3caf301
Show file tree
Hide file tree
Showing 14 changed files with 305 additions and 319 deletions.
13 changes: 6 additions & 7 deletions llvm/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll
Expand Up @@ -5,15 +5,14 @@
; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn,instcombine -S | FileCheck %s

define i32 @test() {
; CHECK: %Y.DONOTREMOVE = load i32, i32* %A
; CHECK: %Y.DONOTREMOVE = load i32, ptr %A
; CHECK: %Z = sub i32 0, %Y.DONOTREMOVE
%A = alloca i32
store i32 0, i32* %A
%X = load i32, i32* %A
%B = bitcast i32* %A to i8*
%C = getelementptr i8, i8* %B, i64 1
store i8 1, i8* %C ; Aliases %A
%Y.DONOTREMOVE = load i32, i32* %A
store i32 0, ptr %A
%X = load i32, ptr %A
%C = getelementptr i8, ptr %A, i64 1
store i8 1, ptr %C ; Aliases %A
%Y.DONOTREMOVE = load i32, ptr %A
%Z = sub i32 %X, %Y.DONOTREMOVE
ret i32 %Z
}
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll
@@ -1,11 +1,11 @@
; RUN: opt < %s -aa-pipeline=basic-aa -passes=dse -S | FileCheck %s

define void @test({i32,i32 }* %P) {
; CHECK: store i32 0, i32* %X
%Q = getelementptr {i32,i32}, {i32,i32}* %P, i32 1
%X = getelementptr {i32,i32}, {i32,i32}* %Q, i32 0, i32 1
%Y = getelementptr {i32,i32}, {i32,i32}* %Q, i32 1, i32 1
store i32 0, i32* %X
store i32 1, i32* %Y
define void @test(ptr %P) {
; CHECK: store i32 0, ptr %X
%Q = getelementptr {i32,i32}, ptr %P, i32 1
%X = getelementptr {i32,i32}, ptr %Q, i32 0, i32 1
%Y = getelementptr {i32,i32}, ptr %Q, i32 1, i32 1
store i32 0, ptr %X
store i32 1, ptr %Y
ret void
}
12 changes: 6 additions & 6 deletions llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll
Expand Up @@ -4,13 +4,13 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-apple-darwin8"
%struct.x = type { [4 x i32] }

define void @foo(%struct.x* byval(%struct.x) align 4 %X) nounwind {
; CHECK: store i32 2, i32* %tmp1
define void @foo(ptr byval(%struct.x) align 4 %X) nounwind {
; CHECK: store i32 2, ptr %tmp1
entry:
%tmp = getelementptr %struct.x, %struct.x* %X, i32 0, i32 0 ; <[4 x i32]*> [#uses=1]
%tmp1 = getelementptr [4 x i32], [4 x i32]* %tmp, i32 0, i32 3 ; <i32*> [#uses=1]
store i32 2, i32* %tmp1, align 4
%tmp2 = call i32 (...) @bar(%struct.x* byval(%struct.x) align 4 %X ) nounwind ; <i32> [#uses=0]
%tmp = getelementptr %struct.x, ptr %X, i32 0, i32 0 ; <ptr> [#uses=1]
%tmp1 = getelementptr [4 x i32], ptr %tmp, i32 0, i32 3 ; <ptr> [#uses=1]
store i32 2, ptr %tmp1, align 4
%tmp2 = call i32 (...) @bar(ptr byval(%struct.x) align 4 %X ) nounwind ; <i32> [#uses=0]
br label %return
return: ; preds = %entry
ret void
Expand Down
14 changes: 7 additions & 7 deletions llvm/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll
@@ -1,14 +1,14 @@
; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn -S | FileCheck %s

declare noalias i32* @noalias()
declare noalias ptr @noalias()

define i32 @test(i32 %x) {
; CHECK: load i32, i32* %a
%a = call i32* @noalias()
store i32 1, i32* %a
%b = getelementptr i32, i32* %a, i32 %x
store i32 2, i32* %b
; CHECK: load i32, ptr %a
%a = call ptr @noalias()
store i32 1, ptr %a
%b = getelementptr i32, ptr %a, i32 %x
store i32 2, ptr %b

%c = load i32, i32* %a
%c = load i32, ptr %a
ret i32 %c
}
20 changes: 10 additions & 10 deletions llvm/test/Analysis/BasicAA/gcsetest.ll
Expand Up @@ -8,35 +8,35 @@
@B = global i32 8

; CHECK: define i32 @test()
; CHECK-NEXT: store i32 123, i32* @B
; CHECK-NEXT: store i32 123, ptr @B
; CHECK-NEXT: ret i32 0

define i32 @test() {
%A1 = load i32, i32* @A
%A1 = load i32, ptr @A

store i32 123, i32* @B ; Store cannot alias @A
store i32 123, ptr @B ; Store cannot alias @A

%A2 = load i32, i32* @A
%A2 = load i32, ptr @A
%X = sub i32 %A1, %A2
ret i32 %X
}

; CHECK: define i32 @test2()
; CHECK-NEXT: br label %Loop
; CHECK: Loop:
; CHECK-NEXT: store i32 0, i32* @B
; CHECK-NEXT: store i32 0, ptr @B
; CHECK-NEXT: br i1 true, label %out, label %Loop
; CHECK: out:
; CHECK-NEXT: ret i32 0

define i32 @test2() {
%A1 = load i32, i32* @A
%A1 = load i32, ptr @A
br label %Loop
Loop:
%AP = phi i32 [0, %0], [%X, %Loop]
store i32 %AP, i32* @B ; Store cannot alias @A
store i32 %AP, ptr @B ; Store cannot alias @A

%A2 = load i32, i32* @A
%A2 = load i32, ptr @A
%X = sub i32 %A1, %A2
%c = icmp eq i32 %X, 0
br i1 %c, label %out, label %Loop
Expand All @@ -53,9 +53,9 @@ declare void @external()

define i32 @test3() {
%X = alloca i32
store i32 7, i32* %X
store i32 7, ptr %X
call void @external()
%V = load i32, i32* %X
%V = load i32, ptr %X
ret i32 %V
}

0 comments on commit 3caf301

Please sign in to comment.