From 3caf301a8be1ebeed466f998bf2b21497f6df760 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 16 Dec 2022 10:53:30 +0100 Subject: [PATCH] [BasicAA] Convert some tests to opaque pointers (NFC) --- .../Analysis/BasicAA/2003-02-26-AccessSizeTest.ll | 13 +- .../Analysis/BasicAA/2004-07-28-MustAliasbug.ll | 14 +- llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll | 12 +- .../test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll | 14 +- llvm/test/Analysis/BasicAA/gcsetest.ll | 20 +- llvm/test/Analysis/BasicAA/gep-alias.ll | 211 ++++++++++---------- llvm/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll | 10 +- llvm/test/Analysis/BasicAA/intrinsics-arm.ll | 22 +-- llvm/test/Analysis/BasicAA/intrinsics.ll | 18 +- llvm/test/Analysis/BasicAA/invariant_load.ll | 12 +- llvm/test/Analysis/BasicAA/modref.ll | 212 ++++++++++----------- llvm/test/Analysis/BasicAA/nocapture.ll | 32 ++-- llvm/test/Analysis/BasicAA/pure-const-dce.ll | 4 +- llvm/test/Analysis/BasicAA/store-promote.ll | 30 +-- 14 files changed, 305 insertions(+), 319 deletions(-) diff --git a/llvm/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll b/llvm/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll index abaddac..ed97d21 100644 --- a/llvm/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll +++ b/llvm/test/Analysis/BasicAA/2003-02-26-AccessSizeTest.ll @@ -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 } diff --git a/llvm/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll b/llvm/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll index 1cd4f37..fd5eb7d 100644 --- a/llvm/test/Analysis/BasicAA/2004-07-28-MustAliasbug.ll +++ b/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 } diff --git a/llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll b/llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll index e5d260c..6cfa736 100644 --- a/llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll +++ b/llvm/test/Analysis/BasicAA/2008-04-15-Byval.ll @@ -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 ; [#uses=1] - store i32 2, i32* %tmp1, align 4 - %tmp2 = call i32 (...) @bar(%struct.x* byval(%struct.x) align 4 %X ) nounwind ; [#uses=0] + %tmp = getelementptr %struct.x, ptr %X, i32 0, i32 0 ; [#uses=1] + %tmp1 = getelementptr [4 x i32], ptr %tmp, i32 0, i32 3 ; [#uses=1] + store i32 2, ptr %tmp1, align 4 + %tmp2 = call i32 (...) @bar(ptr byval(%struct.x) align 4 %X ) nounwind ; [#uses=0] br label %return return: ; preds = %entry ret void diff --git a/llvm/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll b/llvm/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll index 338d167..00f6698 100644 --- a/llvm/test/Analysis/BasicAA/2009-03-04-GEPNoalias.ll +++ b/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 } diff --git a/llvm/test/Analysis/BasicAA/gcsetest.ll b/llvm/test/Analysis/BasicAA/gcsetest.ll index f74aea1..3938a33 100644 --- a/llvm/test/Analysis/BasicAA/gcsetest.ll +++ b/llvm/test/Analysis/BasicAA/gcsetest.ll @@ -8,15 +8,15 @@ @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 } @@ -24,19 +24,19 @@ define i32 @test() { ; 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 @@ -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 } diff --git a/llvm/test/Analysis/BasicAA/gep-alias.ll b/llvm/test/Analysis/BasicAA/gep-alias.ll index 6ac3261..3029862 100644 --- a/llvm/test/Analysis/BasicAA/gep-alias.ll +++ b/llvm/test/Analysis/BasicAA/gep-alias.ll @@ -3,15 +3,13 @@ target datalayout = "e-p:32:32:32-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" ; Make sure that basicaa thinks R and r are must aliases. -define i32 @test1(i8 * %P) { +define i32 @test1(ptr %P) { entry: - %Q = bitcast i8* %P to {i32, i32}* - %R = getelementptr {i32, i32}, {i32, i32}* %Q, i32 0, i32 1 - %S = load i32, i32* %R + %R = getelementptr {i32, i32}, ptr %P, i32 0, i32 1 + %S = load i32, ptr %R - %q = bitcast i8* %P to {i32, i32}* - %r = getelementptr {i32, i32}, {i32, i32}* %q, i32 0, i32 1 - %s = load i32, i32* %r + %r = getelementptr {i32, i32}, ptr %P, i32 0, i32 1 + %s = load i32, ptr %r %t = sub i32 %S, %s ret i32 %t @@ -19,16 +17,15 @@ entry: ; CHECK: ret i32 0 } -define i32 @test2(i8 * %P) { +define i32 @test2(ptr %P) { entry: - %Q = bitcast i8* %P to {i32, i32, i32}* - %R = getelementptr {i32, i32, i32}, {i32, i32, i32}* %Q, i32 0, i32 1 - %S = load i32, i32* %R + %R = getelementptr {i32, i32, i32}, ptr %P, i32 0, i32 1 + %S = load i32, ptr %R - %r = getelementptr {i32, i32, i32}, {i32, i32, i32}* %Q, i32 0, i32 2 - store i32 42, i32* %r + %r = getelementptr {i32, i32, i32}, ptr %P, i32 0, i32 2 + store i32 42, ptr %r - %s = load i32, i32* %R + %s = load i32, ptr %R %t = sub i32 %S, %s ret i32 %t @@ -38,16 +35,16 @@ entry: ; This was a miscompilation. -define i32 @test3({float, {i32, i32, i32}}* %P) { +define i32 @test3(ptr %P) { entry: - %P2 = getelementptr {float, {i32, i32, i32}}, {float, {i32, i32, i32}}* %P, i32 0, i32 1 - %R = getelementptr {i32, i32, i32}, {i32, i32, i32}* %P2, i32 0, i32 1 - %S = load i32, i32* %R + %P2 = getelementptr {float, {i32, i32, i32}}, ptr %P, i32 0, i32 1 + %R = getelementptr {i32, i32, i32}, ptr %P2, i32 0, i32 1 + %S = load i32, ptr %R - %r = getelementptr {i32, i32, i32}, {i32, i32, i32}* %P2, i32 0, i32 2 - store i32 42, i32* %r + %r = getelementptr {i32, i32, i32}, ptr %P2, i32 0, i32 2 + store i32 42, ptr %r - %s = load i32, i32* %R + %s = load i32, ptr %R %t = sub i32 %S, %s ret i32 %t @@ -57,42 +54,42 @@ entry: ;; This is reduced from the SmallPtrSet constructor. -%SmallPtrSetImpl = type { i8**, i32, i32, i32, [1 x i8*] } -%SmallPtrSet64 = type { %SmallPtrSetImpl, [64 x i8*] } +%SmallPtrSetImpl = type { ptr, i32, i32, i32, [1 x ptr] } +%SmallPtrSet64 = type { %SmallPtrSetImpl, [64 x ptr] } -define i32 @test4(%SmallPtrSet64* %P) { +define i32 @test4(ptr %P) { entry: - %tmp2 = getelementptr inbounds %SmallPtrSet64, %SmallPtrSet64* %P, i64 0, i32 0, i32 1 - store i32 64, i32* %tmp2, align 8 - %tmp3 = getelementptr inbounds %SmallPtrSet64, %SmallPtrSet64* %P, i64 0, i32 0, i32 4, i64 64 - store i8* null, i8** %tmp3, align 8 - %tmp4 = load i32, i32* %tmp2, align 8 + %tmp2 = getelementptr inbounds %SmallPtrSet64, ptr %P, i64 0, i32 0, i32 1 + store i32 64, ptr %tmp2, align 8 + %tmp3 = getelementptr inbounds %SmallPtrSet64, ptr %P, i64 0, i32 0, i32 4, i64 64 + store ptr null, ptr %tmp3, align 8 + %tmp4 = load i32, ptr %tmp2, align 8 ret i32 %tmp4 ; CHECK-LABEL: @test4( ; CHECK: ret i32 64 } ; P[i] != p[i+1] -define i32 @test5(i32* %p, i64 %i) { - %pi = getelementptr i32, i32* %p, i64 %i +define i32 @test5(ptr %p, i64 %i) { + %pi = getelementptr i32, ptr %p, i64 %i %i.next = add i64 %i, 1 - %pi.next = getelementptr i32, i32* %p, i64 %i.next - %x = load i32, i32* %pi - store i32 42, i32* %pi.next - %y = load i32, i32* %pi + %pi.next = getelementptr i32, ptr %p, i64 %i.next + %x = load i32, ptr %pi + store i32 42, ptr %pi.next + %y = load i32, ptr %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test5( ; CHECK: ret i32 0 } -define i32 @test5_as1_smaller_size(i32 addrspace(1)* %p, i8 %i) { - %pi = getelementptr i32, i32 addrspace(1)* %p, i8 %i +define i32 @test5_as1_smaller_size(ptr addrspace(1) %p, i8 %i) { + %pi = getelementptr i32, ptr addrspace(1) %p, i8 %i %i.next = add i8 %i, 1 - %pi.next = getelementptr i32, i32 addrspace(1)* %p, i8 %i.next - %x = load i32, i32 addrspace(1)* %pi - store i32 42, i32 addrspace(1)* %pi.next - %y = load i32, i32 addrspace(1)* %pi + %pi.next = getelementptr i32, ptr addrspace(1) %p, i8 %i.next + %x = load i32, ptr addrspace(1) %pi + store i32 42, ptr addrspace(1) %pi.next + %y = load i32, ptr addrspace(1) %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test5_as1_smaller_size( @@ -100,13 +97,13 @@ define i32 @test5_as1_smaller_size(i32 addrspace(1)* %p, i8 %i) { ; CHECK: ret i32 0 } -define i32 @test5_as1_same_size(i32 addrspace(1)* %p, i16 %i) { - %pi = getelementptr i32, i32 addrspace(1)* %p, i16 %i +define i32 @test5_as1_same_size(ptr addrspace(1) %p, i16 %i) { + %pi = getelementptr i32, ptr addrspace(1) %p, i16 %i %i.next = add i16 %i, 1 - %pi.next = getelementptr i32, i32 addrspace(1)* %p, i16 %i.next - %x = load i32, i32 addrspace(1)* %pi - store i32 42, i32 addrspace(1)* %pi.next - %y = load i32, i32 addrspace(1)* %pi + %pi.next = getelementptr i32, ptr addrspace(1) %p, i16 %i.next + %x = load i32, ptr addrspace(1) %pi + store i32 42, ptr addrspace(1) %pi.next + %y = load i32, ptr addrspace(1) %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test5_as1_same_size( @@ -114,14 +111,14 @@ define i32 @test5_as1_same_size(i32 addrspace(1)* %p, i16 %i) { } ; P[i] != p[(i*4)|1] -define i32 @test6(i32* %p, i64 %i1) { +define i32 @test6(ptr %p, i64 %i1) { %i = shl i64 %i1, 2 - %pi = getelementptr i32, i32* %p, i64 %i + %pi = getelementptr i32, ptr %p, i64 %i %i.next = or i64 %i, 1 - %pi.next = getelementptr i32, i32* %p, i64 %i.next - %x = load i32, i32* %pi - store i32 42, i32* %pi.next - %y = load i32, i32* %pi + %pi.next = getelementptr i32, ptr %p, i64 %i.next + %x = load i32, ptr %pi + store i32 42, ptr %pi.next + %y = load i32, ptr %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test6( @@ -129,13 +126,13 @@ define i32 @test6(i32* %p, i64 %i1) { } ; P[1] != P[i*4] -define i32 @test7(i32* %p, i64 %i) { - %pi = getelementptr i32, i32* %p, i64 1 +define i32 @test7(ptr %p, i64 %i) { + %pi = getelementptr i32, ptr %p, i64 1 %i.next = shl i64 %i, 2 - %pi.next = getelementptr i32, i32* %p, i64 %i.next - %x = load i32, i32* %pi - store i32 42, i32* %pi.next - %y = load i32, i32* %pi + %pi.next = getelementptr i32, ptr %p, i64 %i.next + %x = load i32, ptr %pi + store i32 42, ptr %pi.next + %y = load i32, ptr %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test7( @@ -144,53 +141,53 @@ define i32 @test7(i32* %p, i64 %i) { ; P[zext(i)] != p[zext(i+1)] ; PR1143 -define i32 @test8(i32* %p, i16 %i) { +define i32 @test8(ptr %p, i16 %i) { %i1 = zext i16 %i to i32 - %pi = getelementptr i32, i32* %p, i32 %i1 + %pi = getelementptr i32, ptr %p, i32 %i1 %i.next = add i16 %i, 1 %i.next2 = zext i16 %i.next to i32 - %pi.next = getelementptr i32, i32* %p, i32 %i.next2 - %x = load i32, i32* %pi - store i32 42, i32* %pi.next - %y = load i32, i32* %pi + %pi.next = getelementptr i32, ptr %p, i32 %i.next2 + %x = load i32, ptr %pi + store i32 42, ptr %pi.next + %y = load i32, ptr %pi %z = sub i32 %x, %y ret i32 %z ; CHECK-LABEL: @test8( ; CHECK: ret i32 0 } -define i8 @test9([4 x i8] *%P, i32 %i, i32 %j) { +define i8 @test9(ptr %P, i32 %i, i32 %j) { %i2 = shl i32 %i, 2 %i3 = add i32 %i2, 1 ; P2 = P + 1 + 4*i - %P2 = getelementptr [4 x i8], [4 x i8] *%P, i32 0, i32 %i3 + %P2 = getelementptr [4 x i8], ptr %P, i32 0, i32 %i3 %j2 = shl i32 %j, 2 ; P4 = P + 4*j - %P4 = getelementptr [4 x i8], [4 x i8]* %P, i32 0, i32 %j2 + %P4 = getelementptr [4 x i8], ptr %P, i32 0, i32 %j2 - %x = load i8, i8* %P2 - store i8 42, i8* %P4 - %y = load i8, i8* %P2 + %x = load i8, ptr %P2 + store i8 42, ptr %P4 + %y = load i8, ptr %P2 %z = sub i8 %x, %y ret i8 %z ; CHECK-LABEL: @test9( ; CHECK: ret i8 0 } -define i8 @test10([4 x i8] *%P, i32 %i) { +define i8 @test10(ptr %P, i32 %i) { %i2 = shl i32 %i, 2 %i3 = add i32 %i2, 4 ; P2 = P + 4 + 4*i - %P2 = getelementptr [4 x i8], [4 x i8] *%P, i32 0, i32 %i3 + %P2 = getelementptr [4 x i8], ptr %P, i32 0, i32 %i3 ; P4 = P + 4*i - %P4 = getelementptr [4 x i8], [4 x i8]* %P, i32 0, i32 %i2 + %P4 = getelementptr [4 x i8], ptr %P, i32 0, i32 %i2 - %x = load i8, i8* %P2 - store i8 42, i8* %P4 - %y = load i8, i8* %P2 + %x = load i8, ptr %P2 + store i8 42, ptr %P4 + %y = load i8, ptr %P2 %z = sub i8 %x, %y ret i8 %z ; CHECK-LABEL: @test10( @@ -198,32 +195,26 @@ define i8 @test10([4 x i8] *%P, i32 %i) { } ; (This was a miscompilation.) -define float @test11(i32 %indvar, [4 x [2 x float]]* %q) nounwind ssp { +define float @test11(i32 %indvar, ptr %q) nounwind ssp { %tmp = mul i32 %indvar, -1 %dec = add i32 %tmp, 3 - %scevgep = getelementptr [4 x [2 x float]], [4 x [2 x float]]* %q, i32 0, i32 %dec - %scevgep35 = bitcast [2 x float]* %scevgep to i64* - %arrayidx28 = getelementptr inbounds [4 x [2 x float]], [4 x [2 x float]]* %q, i32 0, i32 0 - %y29 = getelementptr inbounds [2 x float], [2 x float]* %arrayidx28, i32 0, i32 1 - store float 1.0, float* %y29, align 4 - store i64 0, i64* %scevgep35, align 4 - %tmp30 = load float, float* %y29, align 4 + %scevgep = getelementptr [4 x [2 x float]], ptr %q, i32 0, i32 %dec + %y29 = getelementptr inbounds [2 x float], ptr %q, i32 0, i32 1 + store float 1.0, ptr %y29, align 4 + store i64 0, ptr %scevgep, align 4 + %tmp30 = load float, ptr %y29, align 4 ret float %tmp30 ; CHECK-LABEL: @test11( ; CHECK: ret float %tmp30 } ; (This was a miscompilation.) -define i32 @test12(i32 %x, i32 %y, i8* %p) nounwind { - %a = bitcast i8* %p to [13 x i8]* - %b = getelementptr [13 x i8], [13 x i8]* %a, i32 %x - %c = bitcast [13 x i8]* %b to [15 x i8]* - %d = getelementptr [15 x i8], [15 x i8]* %c, i32 %y, i32 8 - %castd = bitcast i8* %d to i32* - %castp = bitcast i8* %p to i32* - store i32 1, i32* %castp - store i32 0, i32* %castd - %r = load i32, i32* %castp +define i32 @test12(i32 %x, i32 %y, ptr %p) nounwind { + %b = getelementptr [13 x i8], ptr %p, i32 %x + %d = getelementptr [15 x i8], ptr %b, i32 %y, i32 8 + store i32 1, ptr %p + store i32 0, ptr %d + %r = load i32, ptr %p ret i32 %r ; CHECK-LABEL: @test12( ; CHECK: ret i32 %r @@ -241,38 +232,34 @@ define i32 @test12(i32 %x, i32 %y, i8* %p) nounwind { ; CHECK: store i8 42, ; CHECK: store i8 99, ; Find the loads and make sure they are used in the arguments to the printf. -; CHECK: [[T0ADDR:%[a-zA-Z0-9_]+]] = getelementptr inbounds [3 x i8], [3 x i8]* %t, i32 0, i32 0 -; CHECK: [[T0:%[a-zA-Z0-9_]+]] = load i8, i8* [[T0ADDR]], align 1 +; CHECK: [[T0:%[a-zA-Z0-9_]+]] = load i8, ptr %t, align 1 ; CHECK: [[T0ARG:%[a-zA-Z0-9_]+]] = zext i8 [[T0]] to i32 -; CHECK: [[U0ADDR:%[a-zA-Z0-9_]+]] = getelementptr inbounds [3 x i8], [3 x i8]* %u, i32 0, i32 0 -; CHECK: [[U0:%[a-zA-Z0-9_]+]] = load i8, i8* [[U0ADDR]], align 1 +; CHECK: [[U0:%[a-zA-Z0-9_]+]] = load i8, ptr %u, align 1 ; CHECK: [[U0ARG:%[a-zA-Z0-9_]+]] = zext i8 [[U0]] to i32 -; CHECK: call i32 (i8*, ...) @printf(i8* noundef nonnull dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i32 [[T0ARG]], i32 [[U0ARG]]) +; CHECK: call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 [[T0ARG]], i32 [[U0ARG]]) ; CHECK: ret define void @test13() { entry: %t = alloca [3 x i8], align 1 %u = alloca [3 x i8], align 1 - %tmp = load i32, i32* @P, align 4 + %tmp = load i32, ptr @P, align 4 %tmp1 = mul i32 %tmp, 3 %mul = add i32 %tmp1, -2147483646 %idxprom = zext i32 %mul to i64 - %arrayidx = getelementptr inbounds [3 x i8], [3 x i8]* %t, i64 0, i64 %idxprom - store i8 42, i8* %arrayidx, align 1 - %tmp2 = load i32, i32* @Q, align 4 + %arrayidx = getelementptr inbounds [3 x i8], ptr %t, i64 0, i64 %idxprom + store i8 42, ptr %arrayidx, align 1 + %tmp2 = load i32, ptr @Q, align 4 %tmp3 = mul i32 %tmp2, 3 %mul2 = add i32 %tmp3, 2147483647 %idxprom3 = zext i32 %mul2 to i64 - %arrayidx4 = getelementptr inbounds [3 x i8], [3 x i8]* %u, i64 0, i64 %idxprom3 - store i8 99, i8* %arrayidx4, align 1 - %arrayidx5 = getelementptr inbounds [3 x i8], [3 x i8]* %t, i64 0, i64 0 - %tmp4 = load i8, i8* %arrayidx5, align 1 + %arrayidx4 = getelementptr inbounds [3 x i8], ptr %u, i64 0, i64 %idxprom3 + store i8 99, ptr %arrayidx4, align 1 + %tmp4 = load i8, ptr %t, align 1 %conv = zext i8 %tmp4 to i32 - %arrayidx6 = getelementptr inbounds [3 x i8], [3 x i8]* %u, i64 0, i64 0 - %tmp5 = load i8, i8* %arrayidx6, align 1 + %tmp5 = load i8, ptr %u, align 1 %conv7 = zext i8 %tmp5 to i32 - %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %conv, i32 %conv7) + %call = call i32 (ptr, ...) @printf(ptr @.str, i32 %conv, i32 %conv7) ret void } -declare i32 @printf(i8*, ...) +declare i32 @printf(ptr, ...) diff --git a/llvm/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll b/llvm/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll index c28d23e..9254017 100644 --- a/llvm/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll +++ b/llvm/test/Analysis/BasicAA/getmodrefinfo-cs-cs.ll @@ -12,15 +12,15 @@ define void @test0() { ret void } -; CHECK: NoModRef: call void @llvm.memset.p0i8.i64(i8* @A, i8 0, i64 1, i1 false) <-> call void @llvm.memset.p0i8.i64(i8* @B, i8 0, i64 1, i1 false) -; CHECK: NoModRef: call void @llvm.memset.p0i8.i64(i8* @B, i8 0, i64 1, i1 false) <-> call void @llvm.memset.p0i8.i64(i8* @A, i8 0, i64 1, i1 false) +; CHECK: NoModRef: call void @llvm.memset.p0.i64(ptr @A, i8 0, i64 1, i1 false) <-> call void @llvm.memset.p0.i64(ptr @B, i8 0, i64 1, i1 false) +; CHECK: NoModRef: call void @llvm.memset.p0.i64(ptr @B, i8 0, i64 1, i1 false) <-> call void @llvm.memset.p0.i64(ptr @A, i8 0, i64 1, i1 false) -declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind +declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1) nounwind @A = external global i8 @B = external global i8 define void @test1() { - call void @llvm.memset.p0i8.i64(i8* @A, i8 0, i64 1, i1 false) - call void @llvm.memset.p0i8.i64(i8* @B, i8 0, i64 1, i1 false) + call void @llvm.memset.p0.i64(ptr @A, i8 0, i64 1, i1 false) + call void @llvm.memset.p0.i64(ptr @B, i8 0, i64 1, i1 false) ret void } diff --git a/llvm/test/Analysis/BasicAA/intrinsics-arm.ll b/llvm/test/Analysis/BasicAA/intrinsics-arm.ll index 3fda587..7772cca 100644 --- a/llvm/test/Analysis/BasicAA/intrinsics-arm.ll +++ b/llvm/test/Analysis/BasicAA/intrinsics-arm.ll @@ -7,24 +7,24 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32- ; specifically special cased exactly these two intrinsics in ; MemoryLocation::getForArgument. -; CHECK: define <8 x i16> @test1(i8* %p, <8 x i16> %y) { +; CHECK: define <8 x i16> @test1(ptr %p, <8 x i16> %y) { ; CHECK-NEXT: entry: -; CHECK-NEXT: %q = getelementptr i8, i8* %p, i64 16 -; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0i8(i8* %p, i32 16) [[ATTR:#[0-9]+]] -; CHECK-NEXT: call void @llvm.arm.neon.vst1.p0i8.v8i16(i8* %q, <8 x i16> %y, i32 16) +; CHECK-NEXT: %q = getelementptr i8, ptr %p, i64 16 +; CHECK-NEXT: %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0(ptr %p, i32 16) [[ATTR:#[0-9]+]] +; CHECK-NEXT: call void @llvm.arm.neon.vst1.p0.v8i16(ptr %q, <8 x i16> %y, i32 16) ; CHECK-NEXT: %c = add <8 x i16> %a, %a -define <8 x i16> @test1(i8* %p, <8 x i16> %y) { +define <8 x i16> @test1(ptr %p, <8 x i16> %y) { entry: - %q = getelementptr i8, i8* %p, i64 16 - %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0i8(i8* %p, i32 16) nounwind - call void @llvm.arm.neon.vst1.p0i8.v8i16(i8* %q, <8 x i16> %y, i32 16) - %b = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0i8(i8* %p, i32 16) nounwind + %q = getelementptr i8, ptr %p, i64 16 + %a = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0(ptr %p, i32 16) nounwind + call void @llvm.arm.neon.vst1.p0.v8i16(ptr %q, <8 x i16> %y, i32 16) + %b = call <8 x i16> @llvm.arm.neon.vld1.v8i16.p0(ptr %p, i32 16) nounwind %c = add <8 x i16> %a, %b ret <8 x i16> %c } -declare <8 x i16> @llvm.arm.neon.vld1.v8i16.p0i8(i8*, i32) nounwind readonly -declare void @llvm.arm.neon.vst1.p0i8.v8i16(i8*, <8 x i16>, i32) nounwind +declare <8 x i16> @llvm.arm.neon.vld1.v8i16.p0(ptr, i32) nounwind readonly +declare void @llvm.arm.neon.vst1.p0.v8i16(ptr, <8 x i16>, i32) nounwind ; CHECK: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } ; CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) } diff --git a/llvm/test/Analysis/BasicAA/intrinsics.ll b/llvm/test/Analysis/BasicAA/intrinsics.ll index 3965286..f8b30df 100644 --- a/llvm/test/Analysis/BasicAA/intrinsics.ll +++ b/llvm/test/Analysis/BasicAA/intrinsics.ll @@ -5,22 +5,22 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32- ; BasicAA should prove that these calls don't interfere, since they are ; IntrArgReadMem and have noalias pointers. -; CHECK: define <8 x i16> @test0(<8 x i16>* noalias %p, <8 x i16>* noalias %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { +; CHECK: define <8 x i16> @test0(ptr noalias %p, ptr noalias %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { ; CHECK-NEXT: entry: -; CHECK-NEXT: %a = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) [[ATTR:#[0-9]+]] -; CHECK-NEXT: call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %y, <8 x i16>* %q, i32 16, <8 x i1> %m) +; CHECK-NEXT: %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) [[ATTR:#[0-9]+]] +; CHECK-NEXT: call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m) ; CHECK-NEXT: %c = add <8 x i16> %a, %a -define <8 x i16> @test0(<8 x i16>* noalias %p, <8 x i16>* noalias %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { +define <8 x i16> @test0(ptr noalias %p, ptr noalias %q, <8 x i16> %y, <8 x i1> %m, <8 x i16> %pt) { entry: - %a = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind - call void @llvm.masked.store.v8i16.p0v8i16(<8 x i16> %y, <8 x i16>* %q, i32 16, <8 x i1> %m) - %b = call <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>* %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind + %a = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind + call void @llvm.masked.store.v8i16.p0(<8 x i16> %y, ptr %q, i32 16, <8 x i1> %m) + %b = call <8 x i16> @llvm.masked.load.v8i16.p0(ptr %p, i32 16, <8 x i1> %m, <8 x i16> %pt) nounwind %c = add <8 x i16> %a, %b ret <8 x i16> %c } -declare <8 x i16> @llvm.masked.load.v8i16.p0v8i16(<8 x i16>*, i32, <8 x i1>, <8 x i16>) nounwind readonly -declare void @llvm.masked.store.v8i16.p0v8i16(<8 x i16>, <8 x i16>*, i32, <8 x i1>) nounwind +declare <8 x i16> @llvm.masked.load.v8i16.p0(ptr, i32, <8 x i1>, <8 x i16>) nounwind readonly +declare void @llvm.masked.store.v8i16.p0(<8 x i16>, ptr, i32, <8 x i1>) nounwind ; CHECK: attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } ; CHECK: attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: write) } diff --git a/llvm/test/Analysis/BasicAA/invariant_load.ll b/llvm/test/Analysis/BasicAA/invariant_load.ll index 470ddab..4d987a4 100644 --- a/llvm/test/Analysis/BasicAA/invariant_load.ll +++ b/llvm/test/Analysis/BasicAA/invariant_load.ll @@ -8,18 +8,18 @@ ; return *p + 1; ; } -define i32 @foo(i32* nocapture %p, i8* nocapture %q) { +define i32 @foo(ptr nocapture %p, ptr nocapture %q) { entry: - %0 = load i32, i32* %p, align 4, !invariant.load !3 + %0 = load i32, ptr %p, align 4, !invariant.load !3 %conv = trunc i32 %0 to i8 - store i8 %conv, i8* %q, align 1 - %1 = load i32, i32* %p, align 4, !invariant.load !3 + store i8 %conv, ptr %q, align 1 + %1 = load i32, ptr %p, align 4, !invariant.load !3 %add = add nsw i32 %1, 1 ret i32 %add ; CHECK: foo -; CHECK: %0 = load i32, i32* %p -; CHECK: store i8 %conv, i8* %q, +; CHECK: %0 = load i32, ptr %p +; CHECK: store i8 %conv, ptr %q, ; CHECK: %add = add nsw i32 %0, 1 } diff --git a/llvm/test/Analysis/BasicAA/modref.ll b/llvm/test/Analysis/BasicAA/modref.ll index e29b63d..0619f8e 100644 --- a/llvm/test/Analysis/BasicAA/modref.ll +++ b/llvm/test/Analysis/BasicAA/modref.ll @@ -2,25 +2,25 @@ ; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn,dse -S | FileCheck %s target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) -declare void @external(i32*) +declare void @external(ptr) -define i32 @test0(i8* %P) { +define i32 @test0(ptr %P) { ; CHECK-LABEL: @test0( ; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 -; CHECK-NEXT: call void @external(i32* [[A]]) -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* [[P:%.*]], i8 0, i32 42, i1 false) +; CHECK-NEXT: call void @external(ptr [[A]]) +; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr [[P:%.*]], i8 0, i32 42, i1 false) ; CHECK-NEXT: ret i32 0 ; %A = alloca i32 - call void @external(i32* %A) + call void @external(ptr %A) - store i32 0, i32* %A + store i32 0, ptr %A - call void @llvm.memset.p0i8.i32(i8* %P, i8 0, i32 42, i1 false) + call void @llvm.memset.p0.i32(ptr %P, i8 0, i32 42, i1 false) - %B = load i32, i32* %A + %B = load i32, ptr %A ret i32 %B } @@ -31,229 +31,229 @@ define i8 @test1() { %A = alloca i8 %B = alloca i8 - store i8 2, i8* %B ;; Not written to by memcpy + store i8 2, ptr %B ;; Not written to by memcpy - call void @llvm.memcpy.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i1 false) + call void @llvm.memcpy.p0.p0.i8(ptr %A, ptr %B, i8 -1, i1 false) - %C = load i8, i8* %B + %C = load i8, ptr %B ret i8 %C } -define i8 @test2(i8* %P) { +define i8 @test2(ptr %P) { ; CHECK-LABEL: @test2( -; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, i8* [[P:%.*]], i32 127 -; CHECK-NEXT: store i8 1, i8* [[P2]], align 1 -; CHECK-NEXT: call void @llvm.memset.p0i8.i8(i8* [[P]], i8 2, i8 127, i1 false) +; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr [[P:%.*]], i32 127 +; CHECK-NEXT: store i8 1, ptr [[P2]], align 1 +; CHECK-NEXT: call void @llvm.memset.p0.i8(ptr [[P]], i8 2, i8 127, i1 false) ; CHECK-NEXT: ret i8 1 ; - %P2 = getelementptr i8, i8* %P, i32 127 - store i8 1, i8* %P2 ;; Not dead across memset - call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i1 false) - %A = load i8, i8* %P2 + %P2 = getelementptr i8, ptr %P, i32 127 + store i8 1, ptr %P2 ;; Not dead across memset + call void @llvm.memset.p0.i8(ptr %P, i8 2, i8 127, i1 false) + %A = load i8, ptr %P2 ret i8 %A } -define i8 @test2a(i8* %P) { +define i8 @test2a(ptr %P) { ; CHECK-LABEL: @test2a( -; CHECK-NEXT: call void @llvm.memset.p0i8.i8(i8* [[P:%.*]], i8 2, i8 127, i1 false) +; CHECK-NEXT: call void @llvm.memset.p0.i8(ptr [[P:%.*]], i8 2, i8 127, i1 false) ; CHECK-NEXT: ret i8 2 ; - %P2 = getelementptr i8, i8* %P, i32 126 + %P2 = getelementptr i8, ptr %P, i32 126 - store i8 1, i8* %P2 ;; Dead, clobbered by memset. + store i8 1, ptr %P2 ;; Dead, clobbered by memset. - call void @llvm.memset.p0i8.i8(i8* %P, i8 2, i8 127, i1 false) - %A = load i8, i8* %P2 + call void @llvm.memset.p0.i8(ptr %P, i8 2, i8 127, i1 false) + %A = load i8, ptr %P2 ret i8 %A } -define void @test3(i8* %P, i8 %X) { +define void @test3(ptr %P, i8 %X) { ; CHECK-LABEL: @test3( -; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, i8* [[P:%.*]], i32 2 -; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 1, i8* [[P]]) -; CHECK-NEXT: store i8 2, i8* [[P2]], align 1 +; CHECK-NEXT: [[P2:%.*]] = getelementptr i8, ptr [[P:%.*]], i32 2 +; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 1, ptr [[P]]) +; CHECK-NEXT: store i8 2, ptr [[P2]], align 1 ; CHECK-NEXT: ret void ; %Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead. - %P2 = getelementptr i8, i8* %P, i32 2 - store i8 %Y, i8* %P2 ;; Not read by lifetime.end, should be removed. - call void @llvm.lifetime.end.p0i8(i64 1, i8* %P) - store i8 2, i8* %P2 + %P2 = getelementptr i8, ptr %P, i32 2 + store i8 %Y, ptr %P2 ;; Not read by lifetime.end, should be removed. + call void @llvm.lifetime.end.p0(i64 1, ptr %P) + store i8 2, ptr %P2 ret void } -define void @test3a(i8* %P, i8 %X) { +define void @test3a(ptr %P, i8 %X) { ; CHECK-LABEL: @test3a( -; CHECK-NEXT: call void @llvm.lifetime.end.p0i8(i64 10, i8* [[P:%.*]]) +; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 10, ptr [[P:%.*]]) ; CHECK-NEXT: ret void ; %Y = add i8 %X, 1 ;; Dead, because the only use (the store) is dead. - %P2 = getelementptr i8, i8* %P, i32 2 - store i8 %Y, i8* %P2 - call void @llvm.lifetime.end.p0i8(i64 10, i8* %P) + %P2 = getelementptr i8, ptr %P, i32 2 + store i8 %Y, ptr %P2 + call void @llvm.lifetime.end.p0(i64 10, ptr %P) ret void } @G1 = external global i32 @G2 = external global [4000 x i32] -define i32 @test4(i8* %P) { +define i32 @test4(ptr %P) { ; CHECK-LABEL: @test4( -; CHECK-NEXT: call void @llvm.memset.p0i8.i32(i8* bitcast ([4000 x i32]* @G2 to i8*), i8 0, i32 4000, i1 false) +; CHECK-NEXT: call void @llvm.memset.p0.i32(ptr @G2, i8 0, i32 4000, i1 false) ; CHECK-NEXT: ret i32 0 ; - %tmp = load i32, i32* @G1 - call void @llvm.memset.p0i8.i32(i8* bitcast ([4000 x i32]* @G2 to i8*), i8 0, i32 4000, i1 false) - %tmp2 = load i32, i32* @G1 + %tmp = load i32, ptr @G1 + call void @llvm.memset.p0.i32(ptr @G2, i8 0, i32 4000, i1 false) + %tmp2 = load i32, ptr @G1 %sub = sub i32 %tmp2, %tmp ret i32 %sub } ; Verify that basicaa is handling variable length memcpy, knowing it doesn't ; write to G1. -define i32 @test5(i8* %P, i32 %Len) { +define i32 @test5(ptr %P, i32 %Len) { ; CHECK-LABEL: @test5( -; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([4000 x i32]* @G2 to i8*), i8* bitcast (i32* @G1 to i8*), i32 [[LEN:%.*]], i1 false) +; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr @G2, ptr @G1, i32 [[LEN:%.*]], i1 false) ; CHECK-NEXT: ret i32 0 ; - %tmp = load i32, i32* @G1 - call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([4000 x i32]* @G2 to i8*), i8* bitcast (i32* @G1 to i8*), i32 %Len, i1 false) - %tmp2 = load i32, i32* @G1 + %tmp = load i32, ptr @G1 + call void @llvm.memcpy.p0.p0.i32(ptr @G2, ptr @G1, i32 %Len, i1 false) + %tmp2 = load i32, ptr @G1 %sub = sub i32 %tmp2, %tmp ret i32 %sub } -define i8 @test6(i8* %p, i8* noalias %a) { +define i8 @test6(ptr %p, ptr noalias %a) { ; CHECK-LABEL: @test6( -; CHECK-NEXT: [[X:%.*]] = load i8, i8* [[A:%.*]], align 1 -; CHECK-NEXT: [[T:%.*]] = va_arg i8* [[P:%.*]], float +; CHECK-NEXT: [[X:%.*]] = load i8, ptr [[A:%.*]], align 1 +; CHECK-NEXT: [[T:%.*]] = va_arg ptr [[P:%.*]], float ; CHECK-NEXT: [[Z:%.*]] = add i8 [[X]], [[X]] ; CHECK-NEXT: ret i8 [[Z]] ; - %x = load i8, i8* %a - %t = va_arg i8* %p, float - %y = load i8, i8* %a + %x = load i8, ptr %a + %t = va_arg ptr %p, float + %y = load i8, ptr %a %z = add i8 %x, %y ret i8 %z } ; PR10628 -declare void @test7decl(i32* nocapture %x) +declare void @test7decl(ptr nocapture %x) define i32 @test7() nounwind uwtable ssp { ; CHECK-LABEL: @test7( ; CHECK-NEXT: entry: ; CHECK-NEXT: [[X:%.*]] = alloca i32, align 4 -; CHECK-NEXT: store i32 0, i32* [[X]], align 4 -; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, i32* [[X]], i64 1 -; CHECK-NEXT: call void @test7decl(i32* [[ADD_PTR]]) -; CHECK-NEXT: [[TMP:%.*]] = load i32, i32* [[X]], align 4 +; CHECK-NEXT: store i32 0, ptr [[X]], align 4 +; CHECK-NEXT: [[ADD_PTR:%.*]] = getelementptr inbounds i32, ptr [[X]], i64 1 +; CHECK-NEXT: call void @test7decl(ptr [[ADD_PTR]]) +; CHECK-NEXT: [[TMP:%.*]] = load i32, ptr [[X]], align 4 ; CHECK-NEXT: ret i32 [[TMP]] ; entry: %x = alloca i32, align 4 - store i32 0, i32* %x, align 4 - %add.ptr = getelementptr inbounds i32, i32* %x, i64 1 - call void @test7decl(i32* %add.ptr) - %tmp = load i32, i32* %x, align 4 + store i32 0, ptr %x, align 4 + %add.ptr = getelementptr inbounds i32, ptr %x, i64 1 + call void @test7decl(ptr %add.ptr) + %tmp = load i32, ptr %x, align 4 ret i32 %tmp } ;; Check that aa correctly handles functions marked with argmemonly ;; attribute. -declare i32 @func_argmemonly(i32 * %P) argmemonly +declare i32 @func_argmemonly(ptr %P) argmemonly ;; Can not remove redundant load, function may write to it. -define i32 @test8(i32 *%P) { +define i32 @test8(ptr %P) { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[V1:%.*]] = load i32, i32* [[P:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(i32* [[P]]) -; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[P]], align 4 +; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[P:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(ptr [[P]]) +; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[P]], align 4 ; CHECK-NEXT: [[DIFF:%.*]] = sub i32 [[V1]], [[V2]] ; CHECK-NEXT: ret i32 [[DIFF]] ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly(i32* %P) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly(ptr %P) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } ;; In this case load can be removed, function clobbers only %P2. -define i32 @test9(i32* %P, i32* noalias %P2) { +define i32 @test9(ptr %P, ptr noalias %P2) { ; CHECK-LABEL: @test9( -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(i32* [[P2:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(ptr [[P2:%.*]]) ; CHECK-NEXT: ret i32 0 ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly(i32* %P2) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly(ptr %P2) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } ;; In this case load can *not* be removed. Function clobers only %P2 but it may ;; alias with %P. -define i32 @test10(i32* %P, i32* %P2) { +define i32 @test10(ptr %P, ptr %P2) { ; CHECK-LABEL: @test10( -; CHECK-NEXT: [[V1:%.*]] = load i32, i32* [[P:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(i32* [[P2:%.*]]) -; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[P]], align 4 +; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[P:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(ptr [[P2:%.*]]) +; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[P]], align 4 ; CHECK-NEXT: [[DIFF:%.*]] = sub i32 [[V1]], [[V2]] ; CHECK-NEXT: ret i32 [[DIFF]] ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly(i32* %P2) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly(ptr %P2) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } -define i32 @test11(i32* %P, i32* %P2) { +define i32 @test11(ptr %P, ptr %P2) { ; CHECK-LABEL: @test11( -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(i32* readonly [[P2:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(ptr readonly [[P2:%.*]]) ; CHECK-NEXT: ret i32 0 ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly(i32* readonly %P2) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly(ptr readonly %P2) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } -declare i32 @func_argmemonly_two_args(i32* %P, i32* %P2) argmemonly +declare i32 @func_argmemonly_two_args(ptr %P, ptr %P2) argmemonly -define i32 @test12(i32* %P, i32* %P2, i32* %P3) { +define i32 @test12(ptr %P, ptr %P2, ptr %P3) { ; CHECK-LABEL: @test12( -; CHECK-NEXT: [[V1:%.*]] = load i32, i32* [[P:%.*]], align 4 -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly_two_args(i32* readonly [[P2:%.*]], i32* [[P3:%.*]]) -; CHECK-NEXT: [[V2:%.*]] = load i32, i32* [[P]], align 4 +; CHECK-NEXT: [[V1:%.*]] = load i32, ptr [[P:%.*]], align 4 +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly_two_args(ptr readonly [[P2:%.*]], ptr [[P3:%.*]]) +; CHECK-NEXT: [[V2:%.*]] = load i32, ptr [[P]], align 4 ; CHECK-NEXT: [[DIFF:%.*]] = sub i32 [[V1]], [[V2]] ; CHECK-NEXT: ret i32 [[DIFF]] ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly_two_args(i32* readonly %P2, i32* %P3) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly_two_args(ptr readonly %P2, ptr %P3) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } -define i32 @test13(i32* %P, i32* %P2) { +define i32 @test13(ptr %P, ptr %P2) { ; CHECK-LABEL: @test13( -; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(i32* readnone [[P2:%.*]]) +; CHECK-NEXT: [[TMP1:%.*]] = call i32 @func_argmemonly(ptr readnone [[P2:%.*]]) ; CHECK-NEXT: ret i32 0 ; - %V1 = load i32, i32* %P - call i32 @func_argmemonly(i32* readnone %P2) - %V2 = load i32, i32* %P + %V1 = load i32, ptr %P + call i32 @func_argmemonly(ptr readnone %P2) + %V2 = load i32, ptr %P %Diff = sub i32 %V1, %V2 ret i32 %Diff } -declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i1) nounwind -declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i1) nounwind -declare void @llvm.memcpy.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i1) nounwind -declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind +declare void @llvm.memset.p0.i32(ptr nocapture, i8, i32, i1) nounwind +declare void @llvm.memset.p0.i8(ptr nocapture, i8, i8, i1) nounwind +declare void @llvm.memcpy.p0.p0.i8(ptr nocapture, ptr nocapture, i8, i1) nounwind +declare void @llvm.memcpy.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1) nounwind diff --git a/llvm/test/Analysis/BasicAA/nocapture.ll b/llvm/test/Analysis/BasicAA/nocapture.ll index 3bf29c2..1f9846e 100644 --- a/llvm/test/Analysis/BasicAA/nocapture.ll +++ b/llvm/test/Analysis/BasicAA/nocapture.ll @@ -1,36 +1,36 @@ ; RUN: opt < %s -aa-pipeline=basic-aa -passes=gvn,instcombine -S | FileCheck %s -declare i32* @test(i32* nocapture) +declare ptr @test(ptr nocapture) define i32 @test2() { ; CHECK: ret i32 0 %P = alloca i32 - %Q = call i32* @test(i32* %P) - %a = load i32, i32* %P - store i32 4, i32* %Q ;; cannot clobber P since it is nocapture. - %b = load i32, i32* %P + %Q = call ptr @test(ptr %P) + %a = load i32, ptr %P + store i32 4, ptr %Q ;; cannot clobber P since it is nocapture. + %b = load i32, ptr %P %c = sub i32 %a, %b ret i32 %c } -declare void @test3(i32** %p, i32* %q) nounwind +declare void @test3(ptr %p, ptr %q) nounwind -define i32 @test4(i32* noalias nocapture %p) nounwind { +define i32 @test4(ptr noalias nocapture %p) nounwind { ; CHECK: call void @test3 -; CHECK: store i32 0, i32* %p -; CHECK: store i32 1, i32* %x -; CHECK: %y = load i32, i32* %p +; CHECK: store i32 0, ptr %p +; CHECK: store i32 1, ptr %x +; CHECK: %y = load i32, ptr %p ; CHECK: ret i32 %y entry: - %q = alloca i32* + %q = alloca ptr ; Here test3 might store %p to %q. This doesn't violate %p's nocapture ; attribute since the copy doesn't outlive the function. - call void @test3(i32** %q, i32* %p) nounwind - store i32 0, i32* %p - %x = load i32*, i32** %q + call void @test3(ptr %q, ptr %p) nounwind + store i32 0, ptr %p + %x = load ptr, ptr %q ; This store might write to %p and so we can't eliminate the subsequent ; load - store i32 1, i32* %x - %y = load i32, i32* %p + store i32 1, ptr %x + %y = load i32, ptr %p ret i32 %y } diff --git a/llvm/test/Analysis/BasicAA/pure-const-dce.ll b/llvm/test/Analysis/BasicAA/pure-const-dce.ll index c6b8b06..db310ef 100644 --- a/llvm/test/Analysis/BasicAA/pure-const-dce.ll +++ b/llvm/test/Analysis/BasicAA/pure-const-dce.ll @@ -7,7 +7,7 @@ ; CHECK: %tmp0 = call i32 @TestConst(i32 5) [[READNONE:#[0-9]+]] ; CHECK-NEXT: %tmp1 = call i32 @TestPure(i32 6) [[READONLY:#[0-9]+]] ; CHECK-NEXT: %tmp2 = call i32 @TestNone(i32 7) -; CHECK-NEXT: store i32 1, i32* @g +; CHECK-NEXT: store i32 1, ptr @g ; CHECK-NEXT: %tmp5 = call i32 @TestPure(i32 6) [[READONLY]] ; CHECK-NEXT: %tmp7 = call i32 @TestNone(i32 7) ; CHECK-NEXT: %tmp8 = call i32 @TestNone(i32 7) @@ -26,7 +26,7 @@ entry: %tmp0 = call i32 @TestConst( i32 5 ) readnone ; [#uses=1] %tmp1 = call i32 @TestPure( i32 6 ) readonly ; [#uses=1] %tmp2 = call i32 @TestNone( i32 7 ) ; [#uses=1] - store i32 1, i32* @g + store i32 1, ptr @g %tmp3 = call i32 @TestConst( i32 5 ) readnone ; [#uses=1] %tmp4 = call i32 @TestConst( i32 5 ) readnone ; [#uses=1] %tmp5 = call i32 @TestPure( i32 6 ) readonly ; [#uses=1] diff --git a/llvm/test/Analysis/BasicAA/store-promote.ll b/llvm/test/Analysis/BasicAA/store-promote.ll index fbc7cf6..b9e2ff2 100644 --- a/llvm/test/Analysis/BasicAA/store-promote.ll +++ b/llvm/test/Analysis/BasicAA/store-promote.ll @@ -5,17 +5,17 @@ ; RUN: opt < %s -aa-pipeline=basic-aa -passes='loop-mssa(licm)' -S | FileCheck %s target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" -@A = global i32 7 ; [#uses=3] -@B = global i32 8 ; [#uses=2] -@C = global [2 x i32] [ i32 4, i32 8 ] ; <[2 x i32]*> [#uses=2] +@A = global i32 7 ; [#uses=3] +@B = global i32 8 ; [#uses=2] +@C = global [2 x i32] [ i32 4, i32 8 ] ; [#uses=2] define i32 @test1(i1 %c) { - %Atmp = load i32, i32* @A ; [#uses=2] + %Atmp = load i32, ptr @A ; [#uses=2] br label %Loop Loop: ; preds = %Loop, %0 - %ToRemove = load i32, i32* @A ; [#uses=1] - store i32 %Atmp, i32* @B + %ToRemove = load i32, ptr @A ; [#uses=1] + store i32 %Atmp, ptr @B br i1 %c, label %Out, label %Loop Out: ; preds = %Loop @@ -24,9 +24,9 @@ Out: ; preds = %Loop ; The Loop block should be empty after the load/store are promoted. ; CHECK: @test1 -; CHECK: load i32, i32* @A -; CHECK: load i32, i32* @A -; CHECK: store i32 %Atmp, i32* @B +; CHECK: load i32, ptr @A +; CHECK: load i32, ptr @A +; CHECK: store i32 %Atmp, ptr @B ; CHECK: Loop: ; CHECK-NEXT: br i1 %c, label %Out, label %Loop ; CHECK: Out: @@ -36,12 +36,12 @@ define i32 @test2(i1 %c) { br label %Loop Loop: ; preds = %Loop, %0 - %AVal = load i32, i32* @A ; [#uses=2] - %C0 = getelementptr [2 x i32], [2 x i32]* @C, i64 0, i64 0 ; [#uses=1] - store i32 %AVal, i32* %C0 - %BVal = load i32, i32* @B ; [#uses=2] - %C1 = getelementptr [2 x i32], [2 x i32]* @C, i64 0, i64 1 ; [#uses=1] - store i32 %BVal, i32* %C1 + %AVal = load i32, ptr @A ; [#uses=2] + %C0 = getelementptr [2 x i32], ptr @C, i64 0, i64 0 ; [#uses=1] + store i32 %AVal, ptr %C0 + %BVal = load i32, ptr @B ; [#uses=2] + %C1 = getelementptr [2 x i32], ptr @C, i64 0, i64 1 ; [#uses=1] + store i32 %BVal, ptr %C1 br i1 %c, label %Out, label %Loop Out: ; preds = %Loop -- 2.7.4