diff --git a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll index 162772c3e80dd..139df60a7b916 100644 --- a/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll +++ b/llvm/test/Transforms/LowerTypeTests/aarch64-jumptable.ll @@ -4,9 +4,9 @@ target datalayout = "e-p:64:64" -@0 = private unnamed_addr constant [2 x void (...)*] [void (...)* bitcast (void ()* @f to void (...)*), void (...)* bitcast (void ()* @g to void (...)*)], align 16 +@0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16 -; AARCH64: @f = alias void (), void ()* @[[JT:.*]] +; AARCH64: @f = alias void (), ptr @[[JT:.*]] define void @f() !type !0 { ret void @@ -18,10 +18,10 @@ define internal void @g() !type !0 { !0 = !{i32 0, !"typeid1"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/align.ll b/llvm/test/Transforms/LowerTypeTests/align.ll index 6b780bd51d078..7028209b39b67 100644 --- a/llvm/test/Transforms/LowerTypeTests/align.ll +++ b/llvm/test/Transforms/LowerTypeTests/align.ll @@ -8,9 +8,9 @@ target datalayout = "e-p:32:32" !0 = !{i32 0, !"typeid1"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll b/llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll index 9ca887b2d6fc8..38d98f951bf2b 100644 --- a/llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll +++ b/llvm/test/Transforms/LowerTypeTests/blockaddr-import.ll @@ -3,14 +3,14 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux" -declare i1 @llvm.type.test(i8*, metadata) #1 +declare i1 @llvm.type.test(ptr, metadata) #1 declare !type !11 i32 @o(...) define hidden void @m() #0 !type !3 { entry: br label %n n: - %call = tail call i32 (i8*, ...) bitcast (i32 (...)* @o to i32 (i8*, ...)*)(i8* blockaddress(@m, %n)) #4 + %call = tail call i32 (ptr, ...) @o(ptr blockaddress(@m, %n)) #4 ; Make sure that blockaddress refers to the new function, m.cfi ; CHECK: define hidden void @m.cfi() ; CHECK: blockaddress(@m.cfi, %n) diff --git a/llvm/test/Transforms/LowerTypeTests/blockaddress-2.ll b/llvm/test/Transforms/LowerTypeTests/blockaddress-2.ll index a34400a472657..51a2a59365434 100644 --- a/llvm/test/Transforms/LowerTypeTests/blockaddress-2.ll +++ b/llvm/test/Transforms/LowerTypeTests/blockaddress-2.ll @@ -1,23 +1,23 @@ ; RUN: opt -S %s -passes=lowertypetests | FileCheck %s -; CHECK: @badfileops = internal global %struct.f { void ()* @bad_f, void ()* @bad_f } -; CHECK: @bad_f = internal alias void (), void ()* @.cfi.jumptable +; CHECK: @badfileops = internal global %struct.f { ptr @bad_f, ptr @bad_f } +; CHECK: @bad_f = internal alias void (), ptr @.cfi.jumptable ; CHECK: define internal void @bad_f.cfi() !type !0 { ; CHECK-NEXT: ret void target triple = "x86_64-unknown-linux" -%struct.f = type { void ()*, void ()* } -@badfileops = internal global %struct.f { void ()* @bad_f, void ()* @bad_f }, align 8 +%struct.f = type { ptr, ptr } +@badfileops = internal global %struct.f { ptr @bad_f, ptr @bad_f }, align 8 -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) define internal void @bad_f() !type !1 { ret void } define internal fastcc void @do_f() unnamed_addr !type !2 { - %1 = tail call i1 @llvm.type.test(i8* undef, metadata !"_ZTSFiP4fileP3uioP5ucrediP6threadE"), !nosanitize !3 + %1 = tail call i1 @llvm.type.test(ptr undef, metadata !"_ZTSFiP4fileP3uioP5ucrediP6threadE"), !nosanitize !3 ret void } diff --git a/llvm/test/Transforms/LowerTypeTests/blockaddress.ll b/llvm/test/Transforms/LowerTypeTests/blockaddress.ll index 6860c2631faeb..39740bb8a17be 100644 --- a/llvm/test/Transforms/LowerTypeTests/blockaddress.ll +++ b/llvm/test/Transforms/LowerTypeTests/blockaddress.ll @@ -1,27 +1,27 @@ ; RUN: opt -S %s -passes=lowertypetests | FileCheck %s -; CHECK: define hidden i8* @f2.cfi() !type !0 { +; CHECK: define hidden ptr @f2.cfi() !type !0 { ; CHECK-NEXT: br label %b ; CHECK: b: -; CHECK-NEXT: ret i8* blockaddress(@f2.cfi, %b) +; CHECK-NEXT: ret ptr blockaddress(@f2.cfi, %b) ; CHECK-NEXT: } target triple = "x86_64-unknown-linux" define void @f1() { entry: - %0 = call i1 @llvm.type.test(i8* bitcast (i8* ()* @f2 to i8*), metadata !"_ZTSFvP3bioE") + %0 = call i1 @llvm.type.test(ptr @f2, metadata !"_ZTSFvP3bioE") ret void } -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) -define i8* @f2() !type !5 { +define ptr @f2() !type !5 { br label %b b: - ret i8* blockaddress(@f2, %b) + ret ptr blockaddress(@f2, %b) } !5 = !{i64 0, !"_ZTSFvP3bioE"} diff --git a/llvm/test/Transforms/LowerTypeTests/cfi-direct-call1.ll b/llvm/test/Transforms/LowerTypeTests/cfi-direct-call1.ll index d00701c45a5f2..a684527313e67 100644 --- a/llvm/test/Transforms/LowerTypeTests/cfi-direct-call1.ll +++ b/llvm/test/Transforms/LowerTypeTests/cfi-direct-call1.ll @@ -20,19 +20,17 @@ entry: declare !type !3 !type !4 extern_weak i32 @extern_weak() declare !type !3 !type !4 i32 @extern_decl() -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) define hidden i32 @main(i32 %argc) { entry: %cmp.i = icmp sgt i32 %argc, 1 - %fptr1 = select i1 %cmp.i, i32 ()* @local_func1, i32 ()* @local_func2 - %fptr2 = select i1 %cmp.i, i32 ()* @extern_weak, i32 ()* @extern_decl - %0 = bitcast i32 ()* %fptr1 to i8* - %1 = tail call i1 @llvm.type.test(i8* nonnull %0, metadata !"_ZTSFivE") + %fptr1 = select i1 %cmp.i, ptr @local_func1, ptr @local_func2 + %fptr2 = select i1 %cmp.i, ptr @extern_weak, ptr @extern_decl + %0 = tail call i1 @llvm.type.test(ptr nonnull %fptr1, metadata !"_ZTSFivE") %call2 = tail call i32 %fptr1() - %2 = bitcast i32 ()* %fptr2 to i8* - %3 = tail call i1 @llvm.type.test(i8* %2, metadata !"_ZTSFivE") + %1 = tail call i1 @llvm.type.test(ptr %fptr2, metadata !"_ZTSFivE") %call4 = tail call i32 %fptr2() %call5 = tail call i32 @extern_decl() @@ -55,10 +53,10 @@ entry: ; FULL: define hidden i32 @local_func3(i32 %i) ; Indirect references to local_func1 and local_func2 must to through jump table -; FULL: %fptr1 = select i1 %cmp.i, i32 ()* @local_func1, i32 ()* @local_func2 +; FULL: %fptr1 = select i1 %cmp.i, ptr @local_func1, ptr @local_func2 ; Indirect references to extern_weak and extern_decl must go through jump table -; FULL: %fptr2 = select i1 %cmp.i, i32 ()* select (i1 icmp ne (i32 ()* @extern_weak, i32 ()* null), i32 ()* bitcast ([8 x i8]* getelementptr inbounds ([4 x [8 x i8]], [4 x [8 x i8]]* bitcast (void ()* @.cfi.jumptable to [4 x [8 x i8]]*), i64 0, i64 2) to i32 ()*), i32 ()* null), i32 ()* bitcast ([8 x i8]* getelementptr inbounds ([4 x [8 x i8]], [4 x [8 x i8]]* bitcast (void ()* @.cfi.jumptable to [4 x [8 x i8]]*), i64 0, i64 3) to i32 ()*) +; FULL: %fptr2 = select i1 %cmp.i, ptr select (i1 icmp ne (ptr @extern_weak, ptr null), ptr getelementptr inbounds ([4 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 2), ptr null), ptr getelementptr inbounds ([4 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 3) ; Direct calls to extern_weak and extern_decl should go to original names ; FULL: %call5 = tail call i32 @extern_decl() @@ -81,10 +79,10 @@ entry: ; THIN: define hidden i32 @local_func3.cfi(i32 %i){{.*}} ; Indirect references to local_func1 and local_func2 must to through jump table -; THIN: %fptr1 = select i1 %cmp.i, i32 ()* @local_func1, i32 ()* @local_func2 +; THIN: %fptr1 = select i1 %cmp.i, ptr @local_func1, ptr @local_func2 ; Indirect references to extern_weak and extern_decl must go through jump table -; THIN: %fptr2 = select i1 %cmp.i, i32 ()* select (i1 icmp ne (i32 ()* @extern_weak, i32 ()* null), i32 ()* @extern_weak.cfi_jt, i32 ()* null), i32 ()* @extern_decl.cfi_jt +; THIN: %fptr2 = select i1 %cmp.i, ptr select (i1 icmp ne (ptr @extern_weak, ptr null), ptr @extern_weak.cfi_jt, ptr null), ptr @extern_decl.cfi_jt ; Direct calls to extern_weak and extern_decl should go to original names ; THIN: %call5 = tail call i32 @extern_decl() diff --git a/llvm/test/Transforms/LowerTypeTests/constant.ll b/llvm/test/Transforms/LowerTypeTests/constant.ll index e4cdf04e0f959..5ac96bf0e3c94 100644 --- a/llvm/test/Transforms/LowerTypeTests/constant.ll +++ b/llvm/test/Transforms/LowerTypeTests/constant.ll @@ -8,25 +8,25 @@ target datalayout = "e-p:32:32" !0 = !{i32 0, !"typeid1"} !1 = !{i32 4, !"typeid1"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone ; CHECK: @foo( define i1 @foo() { ; CHECK: ret i1 true - %x = call i1 @llvm.type.test(i8* bitcast (i32* @a to i8*), metadata !"typeid1") + %x = call i1 @llvm.type.test(ptr @a, metadata !"typeid1") ret i1 %x } ; CHECK: @bar( define i1 @bar() { ; CHECK: ret i1 true - %x = call i1 @llvm.type.test(i8* bitcast (i32* getelementptr ([2 x i32], [2 x i32]* @b, i32 0, i32 1) to i8*), metadata !"typeid1") + %x = call i1 @llvm.type.test(ptr getelementptr ([2 x i32], ptr @b, i32 0, i32 1), metadata !"typeid1") ret i1 %x } ; CHECK: @baz( define i1 @baz() { ; CHECK-NOT: ret i1 true - %x = call i1 @llvm.type.test(i8* bitcast (i32* getelementptr ([2 x i32], [2 x i32]* @b, i32 0, i32 0) to i8*), metadata !"typeid1") + %x = call i1 @llvm.type.test(ptr @b, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/drop_type_test_phi.ll b/llvm/test/Transforms/LowerTypeTests/drop_type_test_phi.ll index 46df86b0cc892..3cf4d447605da 100644 --- a/llvm/test/Transforms/LowerTypeTests/drop_type_test_phi.ll +++ b/llvm/test/Transforms/LowerTypeTests/drop_type_test_phi.ll @@ -4,59 +4,56 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-grtev4-linux-gnu" -%struct.A = type { i32 (...)** } +%struct.A = type { ptr } %struct.B = type { %struct.A } %struct.C = type { %struct.A } -@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1 -@_ZTV1C = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.C*, i32)* @_ZN1C1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !2 +@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1 +@_ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2 ; CHECK-LABEL: define i32 @test -define i32 @test(%struct.A* %obj, i32 %a, i32 %b) { +define i32 @test(ptr %obj, i32 %a, i32 %b) { entry: %tobool.not = icmp eq i32 %a, 0 br i1 %tobool.not, label %if.else, label %if.then if.then: - %0 = bitcast %struct.A* %obj to i8*** - %vtable = load i8**, i8*** %0 - %1 = bitcast i8** %vtable to i8* - %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A") + %vtable = load ptr, ptr %obj + %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A") ; CHECK-NOT: @llvm.type.test - %fptrptr = getelementptr i8*, i8** %vtable, i32 1 - %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)** - %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8 - %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a) + %fptrptr = getelementptr ptr, ptr %vtable, i32 1 + %fptr1 = load ptr, ptr %fptrptr, align 8 + %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a) br label %if.end if.else: - %3 = icmp ne i32 %b, 0 + %0 = icmp ne i32 %b, 0 br label %if.end if.end: - %4 = phi i1 [ %3, %if.else ], [ %p, %if.then ] - call void @llvm.assume(i1 %4) + %1 = phi i1 [ %0, %if.else ], [ %p, %if.then ] + call void @llvm.assume(i1 %1) ; Still have the assume, but the type test target replaced with true. -; CHECK: %4 = phi i1 [ %3, %if.else ], [ true, %if.then ] -; CHECK: call void @llvm.assume(i1 %4) +; CHECK: %1 = phi i1 [ %0, %if.else ], [ true, %if.then ] +; CHECK: call void @llvm.assume(i1 %1) ret i32 0 } ; CHECK-LABEL: ret i32 ; CHECK-LABEL: } -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) declare void @llvm.assume(i1) -define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 { +define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 { ret i32 0; } -define i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 { +define i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 { ret i32 0; } -define i32 @_ZN1C1fEi(%struct.C* %this, i32 %a) #0 { +define i32 @_ZN1C1fEi(ptr %this, i32 %a) #0 { ret i32 0; } diff --git a/llvm/test/Transforms/LowerTypeTests/external-global.ll b/llvm/test/Transforms/LowerTypeTests/external-global.ll index 081c8beb1b72a..37d680e6b6cc8 100644 --- a/llvm/test/Transforms/LowerTypeTests/external-global.ll +++ b/llvm/test/Transforms/LowerTypeTests/external-global.ll @@ -7,7 +7,7 @@ target triple = "x86_64-scei-ps4" @dipsy = external constant i8, !type !0 define void @tinkywinky() { - store i8* @dipsy, i8** undef + store ptr @dipsy, ptr undef ret void } diff --git a/llvm/test/Transforms/LowerTypeTests/function-arm-thumb.ll b/llvm/test/Transforms/LowerTypeTests/function-arm-thumb.ll index bbcd9183aad9d..32f91b1481194 100644 --- a/llvm/test/Transforms/LowerTypeTests/function-arm-thumb.ll +++ b/llvm/test/Transforms/LowerTypeTests/function-arm-thumb.ll @@ -22,9 +22,9 @@ define void @h2() "target-features"="-thumb-mode" !type !1 { ret void } -declare void @takeaddr(void()*, void()*, void()*, void()*, void()*) +declare void @takeaddr(ptr, ptr, ptr, ptr, ptr) define void @addrtaken() { - call void @takeaddr(void()* @f1, void()* @g1, void()* @f2, void()* @g2, void()* @h2) + call void @takeaddr(ptr @f1, ptr @g1, ptr @f2, ptr @g2, ptr @h2) ret void } @@ -33,13 +33,13 @@ define void @addrtaken() { ; CHECK: define private void {{.*}} #[[AT:.*]] align 4 { ; CHECK-NEXT: entry: -; CHECK-NEXT: call void asm sideeffect "b.w $0\0Ab.w $1\0A", "s,s"(void ()* @f1.cfi, void ()* @g1.cfi) +; CHECK-NEXT: call void asm sideeffect "b.w $0\0Ab.w $1\0A", "s,s"(ptr @f1.cfi, ptr @g1.cfi) ; CHECK-NEXT: unreachable ; CHECK-NEXT: } ; CHECK: define private void {{.*}} #[[AA:.*]] align 4 { ; CHECK-NEXT: entry: -; CHECK-NEXT: call void asm sideeffect "b $0\0Ab $1\0Ab $2\0A", "s,s,s"(void ()* @f2.cfi, void ()* @g2.cfi, void ()* @h2.cfi) +; CHECK-NEXT: call void asm sideeffect "b $0\0Ab $1\0Ab $2\0A", "s,s,s"(ptr @f2.cfi, ptr @g2.cfi, ptr @h2.cfi) ; CHECK-NEXT: unreachable ; CHECK-NEXT: } diff --git a/llvm/test/Transforms/LowerTypeTests/function-disjoint.ll b/llvm/test/Transforms/LowerTypeTests/function-disjoint.ll index 31df752da624b..92281e274adf0 100644 --- a/llvm/test/Transforms/LowerTypeTests/function-disjoint.ll +++ b/llvm/test/Transforms/LowerTypeTests/function-disjoint.ll @@ -5,11 +5,11 @@ target datalayout = "e-p:64:64" -; X64: @f = alias void (), void ()* @[[JT0:.*]] -; X64: @g = alias void (), void ()* @[[JT1:.*]] +; X64: @f = alias void (), ptr @[[JT0:.*]] +; X64: @g = alias void (), ptr @[[JT1:.*]] ; WASM32: private constant [0 x i8] zeroinitializer -@0 = private unnamed_addr constant [2 x void ()*] [void ()* @f, void ()* @g], align 16 +@0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16 ; X64: define hidden void @f.cfi() ; WASM32: define void @f() !type !{{[0-9]+}} !wasm.index ![[I0:[0-9]+]] @@ -26,24 +26,24 @@ define void @g() !type !1 { !0 = !{i32 0, !"typeid1"} !1 = !{i32 0, !"typeid2"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - ; X64: icmp eq i64 {{.*}}, ptrtoint (void ()* @[[JT0]] to i64) - ; WASM32: icmp eq i64 {{.*}}, ptrtoint (i8* getelementptr (i8, i8* null, i64 1) to i64) - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") - ; X64: icmp eq i64 {{.*}}, ptrtoint (void ()* @[[JT1]] to i64) - ; WASM32: icmp eq i64 {{.*}}, ptrtoint (i8* getelementptr (i8, i8* null, i64 2) to i64) - %y = call i1 @llvm.type.test(i8* %p, metadata !"typeid2") +define i1 @foo(ptr %p) { + ; X64: icmp eq i64 {{.*}}, ptrtoint (ptr @[[JT0]] to i64) + ; WASM32: icmp eq i64 {{.*}}, ptrtoint (ptr getelementptr (i8, ptr null, i64 1) to i64) + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") + ; X64: icmp eq i64 {{.*}}, ptrtoint (ptr @[[JT1]] to i64) + ; WASM32: icmp eq i64 {{.*}}, ptrtoint (ptr getelementptr (i8, ptr null, i64 2) to i64) + %y = call i1 @llvm.type.test(ptr %p, metadata !"typeid2") %z = add i1 %x, %y ret i1 %z } ; X64: define private void @[[JT0]]() #{{.*}} align 8 { -; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @f.cfi) +; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f.cfi) ; X64: define private void @[[JT1]]() #{{.*}} align 8 { -; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @g.cfi) +; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @g.cfi) ; WASM32: ![[I0]] = !{i64 1} ; WASM32: ![[I1]] = !{i64 2} diff --git a/llvm/test/Transforms/LowerTypeTests/function-ext.ll b/llvm/test/Transforms/LowerTypeTests/function-ext.ll index 25edb2e4dcbe0..9f0247365371e 100644 --- a/llvm/test/Transforms/LowerTypeTests/function-ext.ll +++ b/llvm/test/Transforms/LowerTypeTests/function-ext.ll @@ -12,30 +12,30 @@ declare !type !0 void @foo1() declare !type !1 void @foo2() ; CHECK-LABEL: @bar -define i1 @bar(i8* %ptr) { +define i1 @bar(ptr %ptr) { ; CHECK: %[[ICMP:[0-9]+]] = icmp eq ; CHECK: ret i1 %[[ICMP]] - %p = call i1 @llvm.type.test(i8* %ptr, metadata !"type1") + %p = call i1 @llvm.type.test(ptr %ptr, metadata !"type1") ret i1 %p } ; CHECK-LABEL: @baz -define i1 @baz(i8* %ptr) { +define i1 @baz(ptr %ptr) { ; CHECK: ret i1 false - %p = call i1 @llvm.type.test(i8* %ptr, metadata !"type2") + %p = call i1 @llvm.type.test(ptr %ptr, metadata !"type2") ret i1 %p } ; CHECK-LABEL: @addrtaken -define void()* @addrtaken() { - ; X64: ret void ()* @[[JT:.*]] - ret void()* @foo1 +define ptr @addrtaken() { + ; X64: ret ptr @[[JT:.*]] + ret ptr @foo1 } -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone !0 = !{i64 0, !"type1"} !1 = !{i64 0, !"type2"} ; X64: define private void @[[JT]]() #{{.*}} align {{.*}} { -; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(void ()* @foo1) +; X64: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @foo1) diff --git a/llvm/test/Transforms/LowerTypeTests/function-weak.ll b/llvm/test/Transforms/LowerTypeTests/function-weak.ll index 56d5af5f61520..670c0fc7475e8 100644 --- a/llvm/test/Transforms/LowerTypeTests/function-weak.ll +++ b/llvm/test/Transforms/LowerTypeTests/function-weak.ll @@ -8,24 +8,24 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -; CHECK: @x = global void ()* null, align 8 -@x = global void ()* @f, align 8 +; CHECK: @x = global ptr null, align 8 +@x = global ptr @f, align 8 -; CHECK: @x2 = global void ()* null, align 8 -@x2 = global void ()* @f, align 8 +; CHECK: @x2 = global ptr null, align 8 +@x2 = global ptr @f, align 8 -; CHECK: @x3 = internal global void ()* null, align 8 -@x3 = internal constant void ()* @f, align 8 +; CHECK: @x3 = internal global ptr null, align 8 +@x3 = internal constant ptr @f, align 8 ; f + addend -; CHECK: @x4 = global void ()* null, align 8 -@x4 = global void ()* bitcast (i8* getelementptr (i8, i8* bitcast (void ()* @f to i8*), i64 42) to void ()*), align 8 +; CHECK: @x4 = global ptr null, align 8 +@x4 = global ptr getelementptr (i8, ptr @f, i64 42), align 8 ; aggregate initializer -; CHECK: @s = global { void ()*, void ()*, i32 } zeroinitializer, align 8 -@s = global { void ()*, void ()*, i32 } { void ()* @f, void ()* @f, i32 42 }, align 8 +; CHECK: @s = global { ptr, ptr, i32 } zeroinitializer, align 8 +@s = global { ptr, ptr, i32 } { ptr @f, ptr @f, i32 42 }, align 8 -; CHECK: @llvm.global_ctors = appending global {{.*}}{ i32 0, void ()* @__cfi_global_var_init +; CHECK: @llvm.global_ctors = appending global {{.*}}{ i32 0, ptr @__cfi_global_var_init ; CHECK: declare !type !0 extern_weak void @f() declare !type !0 extern_weak void @f() @@ -33,8 +33,8 @@ declare !type !0 extern_weak void @f() ; CHECK: define zeroext i1 @check_f() define zeroext i1 @check_f() { entry: -; CHECK: ret i1 icmp ne (void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT:.*]], void ()* null), void ()* null) - ret i1 icmp ne (void ()* @f, void ()* null) +; CHECK: ret i1 icmp ne (ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT:.*]], ptr null), ptr null) + ret i1 icmp ne (ptr @f, ptr null) } ; CHECK: define void @call_f() { @@ -45,10 +45,10 @@ entry: ret void } -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } @@ -58,11 +58,11 @@ define i1 @foo(i8* %p) { ; CHECK: define internal void @__cfi_global_var_init() section ".text.startup" { ; CHECK-NEXT: entry: -; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x, align 8 -; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x2, align 8 -; CHECK-NEXT: store void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()** @x3, align 8 -; CHECK-NEXT: store void ()* bitcast (i8* getelementptr (i8, i8* bitcast (void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null) to i8*), i64 42) to void ()*), void ()** @x4, align 8 -; CHECK-NEXT: store { void ()*, void ()*, i32 } { void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), void ()* select (i1 icmp ne (void ()* @f, void ()* null), void ()* @[[JT]], void ()* null), i32 42 }, { void ()*, void ()*, i32 }* @s, align 8 +; CHECK-NEXT: store ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), ptr @x, align 8 +; CHECK-NEXT: store ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), ptr @x2, align 8 +; CHECK-NEXT: store ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), ptr @x3, align 8 +; CHECK-NEXT: store ptr getelementptr (i8, ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), i64 42), ptr @x4, align 8 +; CHECK-NEXT: store { ptr, ptr, i32 } { ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), ptr select (i1 icmp ne (ptr @f, ptr null), ptr @[[JT]], ptr null), i32 42 }, ptr @s, align 8 ; CHECK-NEXT: ret void ; CHECK-NEXT: } diff --git a/llvm/test/Transforms/LowerTypeTests/function.ll b/llvm/test/Transforms/LowerTypeTests/function.ll index 944c4ee2b5d53..e472dadd99339 100644 --- a/llvm/test/Transforms/LowerTypeTests/function.ll +++ b/llvm/test/Transforms/LowerTypeTests/function.ll @@ -14,18 +14,18 @@ target datalayout = "e-p:64:64" -; NATIVE: @0 = private unnamed_addr constant [2 x void (...)*] [void (...)* bitcast (void ()* @f to void (...)*), void (...)* bitcast (void ()* @g to void (...)*)], align 16 -@0 = private unnamed_addr constant [2 x void (...)*] [void (...)* bitcast (void ()* @f to void (...)*), void (...)* bitcast (void ()* @g to void (...)*)], align 16 +; NATIVE: @0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16 +@0 = private unnamed_addr constant [2 x ptr] [ptr @f, ptr @g], align 16 ; NATIVE: private constant [0 x i8] zeroinitializer ; WASM32: private constant [0 x i8] zeroinitializer -; NATIVE: @f = alias void (), void ()* @[[JT:.*]] +; NATIVE: @f = alias void (), ptr @[[JT:.*]] -; X86: @g = internal alias void (), bitcast ([8 x i8]* getelementptr inbounds ([2 x [8 x i8]], [2 x [8 x i8]]* bitcast (void ()* @[[JT]] to [2 x [8 x i8]]*), i64 0, i64 1) to void ()*) -; ARM: @g = internal alias void (), bitcast ([4 x i8]* getelementptr inbounds ([2 x [4 x i8]], [2 x [4 x i8]]* bitcast (void ()* @[[JT]] to [2 x [4 x i8]]*), i64 0, i64 1) to void ()*) -; THUMB: @g = internal alias void (), bitcast ([4 x i8]* getelementptr inbounds ([2 x [4 x i8]], [2 x [4 x i8]]* bitcast (void ()* @[[JT]] to [2 x [4 x i8]]*), i64 0, i64 1) to void ()*) -; RISCV: @g = internal alias void (), bitcast ([8 x i8]* getelementptr inbounds ([2 x [8 x i8]], [2 x [8 x i8]]* bitcast (void ()* @[[JT]] to [2 x [8 x i8]]*), i64 0, i64 1) to void ()*) +; X86: @g = internal alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @[[JT]], i64 0, i64 1) +; ARM: @g = internal alias void (), getelementptr inbounds ([2 x [4 x i8]], ptr @[[JT]], i64 0, i64 1) +; THUMB: @g = internal alias void (), getelementptr inbounds ([2 x [4 x i8]], ptr @[[JT]], i64 0, i64 1) +; RISCV: @g = internal alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @[[JT]], i64 0, i64 1) ; NATIVE: define hidden void @f.cfi() ; WASM32: define void @f() !type !{{[0-9]+}} !wasm.index ![[I0:[0-9]+]] @@ -41,13 +41,13 @@ define internal void @g() !type !0 { !0 = !{i32 0, !"typeid1"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - ; NATIVE: sub i64 {{.*}}, ptrtoint (void ()* @[[JT]] to i64) - ; WASM32: sub i64 {{.*}}, ptrtoint (i8* getelementptr (i8, i8* null, i64 1) to i64) +define i1 @foo(ptr %p) { + ; NATIVE: sub i64 {{.*}}, ptrtoint (ptr @[[JT]] to i64) + ; WASM32: sub i64 {{.*}}, ptrtoint (ptr getelementptr (i8, ptr null, i64 1) to i64) ; WASM32: icmp ule i64 {{.*}}, 1 - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } @@ -75,7 +75,7 @@ define i1 @foo(i8* %p) { ; RISCV: tail $0@plt ; RISCV-SAME: tail $1@plt -; NATIVE-SAME: "s,s"(void ()* @f.cfi, void ()* @g.cfi) +; NATIVE-SAME: "s,s"(ptr @f.cfi, ptr @g.cfi) ; X86-LINUX: attributes #[[ATTR]] = { naked nounwind } ; X86-WIN32: attributes #[[ATTR]] = { nounwind } diff --git a/llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll b/llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll index 094c69d12e3be..f67e0b1711652 100644 --- a/llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll +++ b/llvm/test/Transforms/LowerTypeTests/icall-branch-funnel.ll @@ -4,10 +4,10 @@ target datalayout = "e-p:64:64" target triple = "x86_64-unknown-linux" ; CHECK: @0 = private constant { i32, [0 x i8], i32 } { i32 1, [0 x i8] zeroinitializer, i32 2 } -; CHECK: @g1 = alias i32, getelementptr inbounds ({ i32, [0 x i8], i32 }, { i32, [0 x i8], i32 }* @0, i32 0, i32 0) -; CHECK: @g2 = alias i32, getelementptr inbounds ({ i32, [0 x i8], i32 }, { i32, [0 x i8], i32 }* @0, i32 0, i32 2) -; CHECK: @f1 = alias void (), void ()* @.cfi.jumptable -; CHECK: @f2 = alias void (), bitcast ([8 x i8]* getelementptr inbounds ([2 x [8 x i8]], [2 x [8 x i8]]* bitcast (void ()* @.cfi.jumptable to [2 x [8 x i8]]*), i64 0, i64 1) to void ()*) +; CHECK: @g1 = alias i32, ptr @0 +; CHECK: @g2 = alias i32, getelementptr inbounds ({ i32, [0 x i8], i32 }, ptr @0, i32 0, i32 2) +; CHECK: @f1 = alias void (), ptr @.cfi.jumptable +; CHECK: @f2 = alias void (), getelementptr inbounds ([2 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 1) @g1 = constant i32 1 @g2 = constant i32 2 @@ -23,21 +23,21 @@ define void @f2() { declare void @g1f() declare void @g2f() -define void @jt2(i8* nest, ...) { +define void @jt2(ptr nest, ...) { musttail call void (...) @llvm.icall.branch.funnel( - i8* %0, - i32* @g1, void ()* @g1f, - i32* @g2, void ()* @g2f, + ptr %0, + ptr @g1, ptr @g1f, + ptr @g2, ptr @g2f, ... ) ret void } -define void @jt3(i8* nest, ...) { +define void @jt3(ptr nest, ...) { musttail call void (...) @llvm.icall.branch.funnel( - i8* %0, - void ()* @f1, void ()* @f1, - void ()* @f2, void ()* @f2, + ptr %0, + ptr @f1, ptr @f1, + ptr @f2, ptr @f2, ... ) ret void diff --git a/llvm/test/Transforms/LowerTypeTests/import-alias.ll b/llvm/test/Transforms/LowerTypeTests/import-alias.ll index 5d83fc59d6a0a..6eb5a5dfc8fd2 100644 --- a/llvm/test/Transforms/LowerTypeTests/import-alias.ll +++ b/llvm/test/Transforms/LowerTypeTests/import-alias.ll @@ -3,15 +3,15 @@ ; Check that the definitions for @f and @f_alias are removed from this module ; but @g_alias remains. ; -; CHECK: @g_alias = alias void (), void ()* @g +; CHECK: @g_alias = alias void (), ptr @g ; CHECK: define hidden void @f.cfi ; CHECK: declare void @f() ; CHECK: declare void @f_alias() target triple = "x86_64-unknown-linux" -@f_alias = alias void (), void ()* @f -@g_alias = alias void (), void ()* @g +@f_alias = alias void (), ptr @f +@g_alias = alias void (), ptr @g ; Definition moved to the merged module define void @f() { diff --git a/llvm/test/Transforms/LowerTypeTests/import-icall.ll b/llvm/test/Transforms/LowerTypeTests/import-icall.ll index 80e7db036c6f9..e5ff5beccb061 100644 --- a/llvm/test/Transforms/LowerTypeTests/import-icall.ll +++ b/llvm/test/Transforms/LowerTypeTests/import-icall.ll @@ -3,10 +3,10 @@ target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -@llvm.used = appending global [1 x i8*] [i8* bitcast (i8* ()* @local_decl to i8*)], section "llvm.metadata" -@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i8* ()* @local_decl to i8*)], section "llvm.metadata" +@llvm.used = appending global [1 x ptr] [ptr @local_decl], section "llvm.metadata" +@llvm.compiler.used = appending global [1 x ptr] [ptr @local_decl], section "llvm.metadata" -@local_decl_alias = alias i8* (), i8* ()* @local_decl +@local_decl_alias = alias ptr (), ptr @local_decl define i8 @local_a() { call void @external() @@ -24,15 +24,15 @@ define i8 @use_b() { ret i8 %x } -define i8* @local_decl() { - call i8* @local_decl() - ret i8* bitcast (i8* ()* @local_decl to i8*) +define ptr @local_decl() { + call ptr @local_decl() + ret ptr @local_decl } declare void @external() declare extern_weak void @external_weak() -; CHECK: @local_decl_alias = alias i8* (), i8* ()* @local_decl +; CHECK: @local_decl_alias = alias ptr (), ptr @local_decl ; CHECK: define hidden i8 @local_a.cfi() { ; CHECK-NEXT: call void @external() @@ -44,9 +44,9 @@ declare extern_weak void @external_weak() ; CHECK: define internal i8 @local_b() { ; CHECK-NEXT: call i8 @local_a() -; CHECK: define i8* @local_decl() -; CHECK-NEXT: call i8* @local_decl() -; CHECK-NEXT: ret i8* bitcast (i8* ()* @local_decl.cfi_jt to i8*) +; CHECK: define ptr @local_decl() +; CHECK-NEXT: call ptr @local_decl() +; CHECK-NEXT: ret ptr @local_decl.cfi_jt ; CHECK: declare void @external() ; CHECK: declare extern_weak void @external_weak() diff --git a/llvm/test/Transforms/LowerTypeTests/import-unsat.ll b/llvm/test/Transforms/LowerTypeTests/import-unsat.ll index 76111f2cb2ca0..76afe68d21891 100644 --- a/llvm/test/Transforms/LowerTypeTests/import-unsat.ll +++ b/llvm/test/Transforms/LowerTypeTests/import-unsat.ll @@ -19,10 +19,10 @@ target datalayout = "e-p:32:32" -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ; CHECK: ret i1 false ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/import.ll b/llvm/test/Transforms/LowerTypeTests/import.ll index 14117733cd199..812c0619a169a 100644 --- a/llvm/test/Transforms/LowerTypeTests/import.ll +++ b/llvm/test/Transforms/LowerTypeTests/import.ll @@ -3,7 +3,7 @@ target datalayout = "e-p:64:64" -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone ; CHECK-DAG: @__typeid_single_global_addr = external hidden global [0 x i8] ; CHECK-DAG: @__typeid_inline6_global_addr = external hidden global [0 x i8] @@ -31,104 +31,104 @@ declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone ; X86-DAG: @__typeid_allones7_align = external hidden global [0 x i8], !absolute_symbol !0 ; X86-DAG: @__typeid_allones7_size_m1 = external hidden global [0 x i8], !absolute_symbol !5 -; CHECK: define i1 @allones7(i8* [[p:%.*]]) -define i1 @allones7(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_allones7_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_allones7_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_allones7_align to i8)) to i64) +; CHECK: define i1 @allones7(ptr [[p:%.*]]) +define i1 @allones7(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_allones7_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_allones7_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_allones7_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 1 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 63 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_allones7_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_allones7_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 42 ; CHECK-NEXT: ret i1 [[ule]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"allones7") + %x = call i1 @llvm.type.test(ptr %p, metadata !"allones7") ret i1 %x } -; CHECK: define i1 @allones32(i8* [[p:%.*]]) -define i1 @allones32(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_allones32_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_allones32_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_allones32_align to i8)) to i64) +; CHECK: define i1 @allones32(ptr [[p:%.*]]) +define i1 @allones32(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_allones32_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_allones32_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_allones32_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 2 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 62 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_allones32_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_allones32_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 12345 ; CHECK-NEXT: ret i1 [[ule]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"allones32") + %x = call i1 @llvm.type.test(ptr %p, metadata !"allones32") ret i1 %x } -; CHECK: define i1 @bytearray7(i8* [[p:%.*]]) -define i1 @bytearray7(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_bytearray7_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8)) to i64) +; CHECK: define i1 @bytearray7(ptr [[p:%.*]]) +define i1 @bytearray7(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_bytearray7_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_bytearray7_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_bytearray7_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 3 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 61 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_bytearray7_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_bytearray7_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 43 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: - ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_bytearray7_byte_array, i32 0, i32 0), i64 [[or]] - ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]] - ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint ([0 x i8]* @__typeid_bytearray7_bit_mask to i8) - ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* inttoptr (i64 64 to i8*) to i8) + ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, ptr @__typeid_bytearray7_byte_array, i64 [[or]] + ; CHECK-NEXT: [[load:%.*]] = load i8, ptr [[gep]] + ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (ptr @__typeid_bytearray7_bit_mask to i8) + ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (ptr inttoptr (i64 64 to ptr) to i8) ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0 ; CHECK-NEXT: br label %[[f]] ; CHECK: [[f]]: ; CHECK-NEXT: [[phi:%.*]] = phi i1 [ false, %0 ], [ [[ne]], %[[t]] ] ; CHECK-NEXT: ret i1 [[phi]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"bytearray7") + %x = call i1 @llvm.type.test(ptr %p, metadata !"bytearray7") ret i1 %x } -; CHECK: define i1 @bytearray32(i8* [[p:%.*]]) -define i1 @bytearray32(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_bytearray32_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_bytearray32_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_bytearray32_align to i8)) to i64) +; CHECK: define i1 @bytearray32(ptr [[p:%.*]]) +define i1 @bytearray32(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_bytearray32_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_bytearray32_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_bytearray32_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 4 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 60 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_bytearray32_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_bytearray32_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 12346 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: - ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_bytearray32_byte_array, i32 0, i32 0), i64 [[or]] - ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]] - ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint ([0 x i8]* @__typeid_bytearray32_bit_mask to i8) - ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (i8* inttoptr (i64 128 to i8*) to i8) + ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, ptr @__typeid_bytearray32_byte_array, i64 [[or]] + ; CHECK-NEXT: [[load:%.*]] = load i8, ptr [[gep]] + ; X86-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (ptr @__typeid_bytearray32_bit_mask to i8) + ; ARM-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (ptr inttoptr (i64 128 to ptr) to i8) ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0 ; CHECK-NEXT: br label %[[f]] ; CHECK: [[f]]: ; CHECK-NEXT: [[phi:%.*]] = phi i1 [ false, %0 ], [ [[ne]], %[[t]] ] ; CHECK-NEXT: ret i1 [[phi]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"bytearray32") + %x = call i1 @llvm.type.test(ptr %p, metadata !"bytearray32") ret i1 %x } -; CHECK: define i1 @inline5(i8* [[p:%.*]]) -define i1 @inline5(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_inline5_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_inline5_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_inline5_align to i8)) to i64) +; CHECK: define i1 @inline5(ptr [[p:%.*]]) +define i1 @inline5(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_inline5_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_inline5_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_inline5_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 5 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 59 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_inline5_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_inline5_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 31 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] @@ -136,7 +136,7 @@ define i1 @inline5(i8* %p) { ; CHECK-NEXT: [[trunc:%.*]] = trunc i64 [[or]] to i32 ; CHECK-NEXT: [[and:%.*]] = and i32 [[trunc]], 31 ; CHECK-NEXT: [[shl2:%.*]] = shl i32 1, [[and]] - ; X86-NEXT: [[and2:%.*]] = and i32 ptrtoint ([0 x i8]* @__typeid_inline5_inline_bits to i32), [[shl2]] + ; X86-NEXT: [[and2:%.*]] = and i32 ptrtoint (ptr @__typeid_inline5_inline_bits to i32), [[shl2]] ; ARM-NEXT: [[and2:%.*]] = and i32 123, [[shl2]] ; CHECK-NEXT: [[ne:%.*]] = icmp ne i32 [[and2]], 0 ; CHECK-NEXT: br label %[[f]] @@ -144,27 +144,27 @@ define i1 @inline5(i8* %p) { ; CHECK: [[f]]: ; CHECK-NEXT: [[phi:%.*]] = phi i1 [ false, %0 ], [ [[ne]], %[[t]] ] ; CHECK-NEXT: ret i1 [[phi]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"inline5") + %x = call i1 @llvm.type.test(ptr %p, metadata !"inline5") ret i1 %x } -; CHECK: define i1 @inline6(i8* [[p:%.*]]) -define i1 @inline6(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_inline6_global_addr to i64) - ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_inline6_align to i8) to i64) - ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_inline6_align to i8)) to i64) +; CHECK: define i1 @inline6(ptr [[p:%.*]]) +define i1 @inline6(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_inline6_global_addr to i64) + ; X86-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_inline6_align to i8) to i64) + ; X86-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_inline6_align to i8)) to i64) ; ARM-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], 6 ; ARM-NEXT: [[shl:%.*]] = shl i64 [[sub]], 58 ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_inline6_size_m1 to i64) + ; X86-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_inline6_size_m1 to i64) ; ARM-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], 63 ; CHECK-NEXT: br i1 [[ule]], label %[[t:.*]], label %[[f:.*]] ; CHECK: [[t]]: ; CHECK-NEXT: [[and:%.*]] = and i64 [[or]], 63 ; CHECK-NEXT: [[shl2:%.*]] = shl i64 1, [[and]] - ; X86-NEXT: [[and2:%.*]] = and i64 ptrtoint ([0 x i8]* @__typeid_inline6_inline_bits to i64), [[shl2]] + ; X86-NEXT: [[and2:%.*]] = and i64 ptrtoint (ptr @__typeid_inline6_inline_bits to i64), [[shl2]] ; ARM-NEXT: [[and2:%.*]] = and i64 1000000000000, [[shl2]] ; CHECK-NEXT: [[ne:%.*]] = icmp ne i64 [[and2]], 0 ; CHECK-NEXT: br label %[[f]] @@ -172,16 +172,16 @@ define i1 @inline6(i8* %p) { ; CHECK: [[f]]: ; CHECK-NEXT: [[phi:%.*]] = phi i1 [ false, %0 ], [ [[ne]], %[[t]] ] ; CHECK-NEXT: ret i1 [[phi]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"inline6") + %x = call i1 @llvm.type.test(ptr %p, metadata !"inline6") ret i1 %x } -; CHECK: define i1 @single(i8* [[p:%.*]]) -define i1 @single(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[eq:%.*]] = icmp eq i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_single_global_addr to i64) +; CHECK: define i1 @single(ptr [[p:%.*]]) +define i1 @single(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[eq:%.*]] = icmp eq i64 [[pi]], ptrtoint (ptr @__typeid_single_global_addr to i64) ; CHECK-NEXT: ret i1 [[eq]] - %x = call i1 @llvm.type.test(i8* %p, metadata !"single") + %x = call i1 @llvm.type.test(ptr %p, metadata !"single") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/layout.ll b/llvm/test/Transforms/LowerTypeTests/layout.ll index 51d36de6bf3bd..d5a71d78aca4c 100644 --- a/llvm/test/Transforms/LowerTypeTests/layout.ll +++ b/llvm/test/Transforms/LowerTypeTests/layout.ll @@ -17,11 +17,11 @@ target datalayout = "e-p:32:32" !1 = !{i32 0, !"typeid2"} !2 = !{i32 0, !"typeid3"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone define void @foo() { - %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1") - %y = call i1 @llvm.type.test(i8* undef, metadata !"typeid2") - %z = call i1 @llvm.type.test(i8* undef, metadata !"typeid3") + %x = call i1 @llvm.type.test(ptr undef, metadata !"typeid1") + %y = call i1 @llvm.type.test(ptr undef, metadata !"typeid2") + %z = call i1 @llvm.type.test(ptr undef, metadata !"typeid3") ret void } diff --git a/llvm/test/Transforms/LowerTypeTests/nocfivalue.ll b/llvm/test/Transforms/LowerTypeTests/nocfivalue.ll index 8af25b5cc0447..33868d541d456 100644 --- a/llvm/test/Transforms/LowerTypeTests/nocfivalue.ll +++ b/llvm/test/Transforms/LowerTypeTests/nocfivalue.ll @@ -3,8 +3,8 @@ target datalayout = "e-p:64:64" target triple = "x86_64-unknown-linux-gnu" -; CHECK: @a = global [6 x void ()*] [void ()* no_cfi @f1, void ()* @.cfi.jumptable, void ()* bitcast ([8 x i8]* getelementptr inbounds ([3 x [8 x i8]], [3 x [8 x i8]]* bitcast (void ()* @.cfi.jumptable to [3 x [8 x i8]]*), i64 0, i64 1) to void ()*), void ()* no_cfi @f2, void ()* @f3, void ()* no_cfi @f3.cfi] -@a = global [6 x void ()*] [void ()* no_cfi @f1, void ()* @f1, void ()* @f2, void ()* no_cfi @f2, void ()* @f3, void ()* no_cfi @f3] +; CHECK: @a = global [6 x ptr] [ptr no_cfi @f1, ptr @.cfi.jumptable, ptr getelementptr inbounds ([3 x [8 x i8]], ptr @.cfi.jumptable, i64 0, i64 1), ptr no_cfi @f2, ptr @f3, ptr no_cfi @f3.cfi] +@a = global [6 x ptr] [ptr no_cfi @f1, ptr @f1, ptr @f2, ptr no_cfi @f2, ptr @f3, ptr no_cfi @f3] ; CHECK: define void @f1() define void @f1() !type !0 { @@ -21,10 +21,10 @@ define void @f3() #0 !type !0 { ret void } -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/nonstring.ll b/llvm/test/Transforms/LowerTypeTests/nonstring.ll index cfae7aca7e94a..ff8cc52d48344 100644 --- a/llvm/test/Transforms/LowerTypeTests/nonstring.ll +++ b/llvm/test/Transforms/LowerTypeTests/nonstring.ll @@ -15,18 +15,18 @@ target datalayout = "e-p:32:32" !2 = distinct !{} !3 = distinct !{} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone ; CHECK-LABEL: @foo -define i1 @foo(i8* %p) { - ; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ i32 }* @[[ANAME]] to i32) - %x = call i1 @llvm.type.test(i8* %p, metadata !2) +define i1 @foo(ptr %p) { + ; CHECK: icmp eq i32 {{.*}}, ptrtoint (ptr @[[ANAME]] to i32) + %x = call i1 @llvm.type.test(ptr %p, metadata !2) ret i1 %x } ; CHECK-LABEL: @bar -define i1 @bar(i8* %p) { - ; CHECK: icmp eq i32 {{.*}}, ptrtoint ({ [2 x i32] }* @[[BNAME]] to i32) - %x = call i1 @llvm.type.test(i8* %p, metadata !3) +define i1 @bar(ptr %p) { + ; CHECK: icmp eq i32 {{.*}}, ptrtoint (ptr @[[BNAME]] to i32) + %x = call i1 @llvm.type.test(ptr %p, metadata !3) ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/pr25902.ll b/llvm/test/Transforms/LowerTypeTests/pr25902.ll index 2bd010c0deab7..c5fa7b0e64aa2 100644 --- a/llvm/test/Transforms/LowerTypeTests/pr25902.ll +++ b/llvm/test/Transforms/LowerTypeTests/pr25902.ll @@ -1,10 +1,9 @@ ; PR25902: gold plugin crash. ; RUN: opt -mtriple=i686-pc -S -passes=lowertypetests < %s -define void @f(void ()* %p) { +define void @f(ptr %p) { entry: - %a = bitcast void ()* %p to i8*, !nosanitize !1 - %b = call i1 @llvm.type.test(i8* %a, metadata !"_ZTSFvvE"), !nosanitize !1 + %b = call i1 @llvm.type.test(ptr %p, metadata !"_ZTSFvvE"), !nosanitize !1 ret void } @@ -13,7 +12,7 @@ entry: ret void } -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) !0 = !{i64 0, !"_ZTSFvvE"} !1 = !{} diff --git a/llvm/test/Transforms/LowerTypeTests/pr48245.ll b/llvm/test/Transforms/LowerTypeTests/pr48245.ll index 592ecee15063b..144296ab5cd7c 100644 --- a/llvm/test/Transforms/LowerTypeTests/pr48245.ll +++ b/llvm/test/Transforms/LowerTypeTests/pr48245.ll @@ -9,39 +9,37 @@ source_filename = "pr48245.cpp" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -%struct.Foo = type { i32 (...)** } +%struct.Foo = type { ptr } ; Check that the vtable was not turned into an alias to a rewritten private ; global. ; CHECK: @_ZTV3Foo = dso_local unnamed_addr constant -@_ZTV3Foo = dso_local unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI3Foo to i8*), i8* bitcast (i32 (%struct.Foo*)* @_ZN3Foo2f1Ev to i8*), i8* bitcast (i32 (%struct.Foo*)* @_ZN3Foo2f2Ev to i8*)] }, align 8, !type !0, !type !1, !type !2 +@_ZTV3Foo = dso_local unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr @_ZTI3Foo, ptr @_ZN3Foo2f1Ev, ptr @_ZN3Foo2f2Ev] }, align 8, !type !0, !type !1, !type !2 -@_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global i8* +@_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global ptr @_ZTS3Foo = dso_local constant [5 x i8] c"3Foo\00", align 1 -@_ZTI3Foo = dso_local constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @_ZTS3Foo, i32 0, i32 0) }, align 8 -@b = dso_local local_unnamed_addr global %struct.Foo* null, align 8 +@_ZTI3Foo = dso_local constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS3Foo }, align 8 +@b = dso_local local_unnamed_addr global ptr null, align 8 define dso_local i32 @main() local_unnamed_addr { entry: - %0 = load %struct.Foo*, %struct.Foo** @b, align 8 - %1 = bitcast %struct.Foo* %0 to i32 (%struct.Foo*)*** - %vtable.i = load i32 (%struct.Foo*)**, i32 (%struct.Foo*)*** %1, align 8 - %2 = bitcast i32 (%struct.Foo*)** %vtable.i to i8* + %0 = load ptr, ptr @b, align 8 + %vtable.i = load ptr, ptr %0, align 8 ; Check that the type test was not lowered. ; CHECK: tail call i1 @llvm.type.test - %3 = tail call i1 @llvm.type.test(i8* %2, metadata !"_ZTS3Foo") + %1 = tail call i1 @llvm.type.test(ptr %vtable.i, metadata !"_ZTS3Foo") - tail call void @llvm.assume(i1 %3) - %4 = load i32 (%struct.Foo*)*, i32 (%struct.Foo*)** %vtable.i, align 8 - %call.i = tail call i32 %4(%struct.Foo* nonnull dereferenceable(8) %0) + tail call void @llvm.assume(i1 %1) + %2 = load ptr, ptr %vtable.i, align 8 + %call.i = tail call i32 %2(ptr nonnull dereferenceable(8) %0) ret i32 %call.i } -declare i1 @llvm.type.test(i8*, metadata) +declare i1 @llvm.type.test(ptr, metadata) declare void @llvm.assume(i1 noundef) -declare dso_local i32 @_ZN3Foo2f1Ev(%struct.Foo* nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr -declare dso_local i32 @_ZN3Foo2f2Ev(%struct.Foo* nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr +declare dso_local i32 @_ZN3Foo2f1Ev(ptr nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr +declare dso_local i32 @_ZN3Foo2f2Ev(ptr nocapture nonnull readnone dereferenceable(8) %this) unnamed_addr !0 = !{i64 16, !"_ZTS3Foo"} !1 = !{i64 16, !"_ZTSM3FooFivE.virtual"} diff --git a/llvm/test/Transforms/LowerTypeTests/section.ll b/llvm/test/Transforms/LowerTypeTests/section.ll index ab8f1b96edb4a..d0d3c212c826e 100644 --- a/llvm/test/Transforms/LowerTypeTests/section.ll +++ b/llvm/test/Transforms/LowerTypeTests/section.ll @@ -5,7 +5,7 @@ target triple = "x86_64-unknown-linux-gnu" -; CHECK: @f = alias void (), void ()* @[[JT:.*]] +; CHECK: @f = alias void (), ptr @[[JT:.*]] ; CHECK: define hidden void @f.cfi() section "xxx" define void @f() section "xxx" !type !0 { @@ -15,12 +15,12 @@ entry: define i1 @g() { entry: - %0 = call i1 @llvm.type.test(i8* bitcast (void ()* @f to i8*), metadata !"_ZTSFvE") + %0 = call i1 @llvm.type.test(ptr @f, metadata !"_ZTSFvE") ret i1 %0 } ; CHECK: define private void @[[JT]]() #{{.*}} align {{.*}} { -declare i1 @llvm.type.test(i8*, metadata) nounwind readnone +declare i1 @llvm.type.test(ptr, metadata) nounwind readnone !0 = !{i64 0, !"_ZTSFvE"} diff --git a/llvm/test/Transforms/LowerTypeTests/simple.ll b/llvm/test/Transforms/LowerTypeTests/simple.ll index 1aebed04aae11..c7ba3777b25d8 100644 --- a/llvm/test/Transforms/LowerTypeTests/simple.ll +++ b/llvm/test/Transforms/LowerTypeTests/simple.ll @@ -30,84 +30,78 @@ target datalayout = "e-p:32:32" ; Offset 0, 4 byte alignment !2 = !{i32 0, !"typeid3"} -; CHECK: @bits_use{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}} -; CHECK: @bits_use.{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}} -; CHECK: @bits_use.{{[0-9]*}} = private alias i8, i8* @bits{{[0-9]*}} +; CHECK: @bits_use{{[0-9]*}} = private alias i8, ptr @bits{{[0-9]*}} +; CHECK: @bits_use.{{[0-9]*}} = private alias i8, ptr @bits{{[0-9]*}} +; CHECK: @bits_use.{{[0-9]*}} = private alias i8, ptr @bits{{[0-9]*}} -; CHECK: @a = alias i32, getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 0) -; CHECK: @b = hidden alias [63 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 2) -; CHECK: @c = protected alias i32, getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 4) -; CHECK: @d = alias [2 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, { i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]], i32 0, i32 6) +; CHECK: @a = alias i32, ptr [[G]] +; CHECK: @b = hidden alias [63 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, ptr [[G]], i32 0, i32 2) +; CHECK: @c = protected alias i32, getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, ptr [[G]], i32 0, i32 4) +; CHECK: @d = alias [2 x i32], getelementptr inbounds ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }, ptr [[G]], i32 0, i32 6) -; CHECK: @bits{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0) -; CHECK: @bits.{{[0-9]*}} = private alias i8, getelementptr inbounds ([68 x i8], [68 x i8]* [[BA]], i32 0, i32 0) +; CHECK: @bits{{[0-9]*}} = private alias i8, ptr [[BA]] +; CHECK: @bits.{{[0-9]*}} = private alias i8, ptr [[BA]] -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -; CHECK: @foo(i32* [[A0:%[^ ]*]]) -define i1 @foo(i32* %p) { +; CHECK: @foo(ptr [[A0:%[^ ]*]]) +define i1 @foo(ptr %p) { ; CHECK-NOT: llvm.type.test - ; CHECK: [[R0:%[^ ]*]] = bitcast i32* [[A0]] to i8* - %pi8 = bitcast i32* %p to i8* - ; CHECK: [[R1:%[^ ]*]] = ptrtoint i8* [[R0]] to i32 - ; CHECK: [[R2:%[^ ]*]] = sub i32 [[R1]], ptrtoint ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]] to i32) + ; CHECK: [[R1:%[^ ]*]] = ptrtoint ptr %p to i32 + ; CHECK: [[R2:%[^ ]*]] = sub i32 [[R1]], ptrtoint (ptr [[G]] to i32) ; CHECK: [[R3:%[^ ]*]] = lshr i32 [[R2]], 2 ; CHECK: [[R4:%[^ ]*]] = shl i32 [[R2]], 30 ; CHECK: [[R5:%[^ ]*]] = or i32 [[R3]], [[R4]] ; CHECK: [[R6:%[^ ]*]] = icmp ule i32 [[R5]], 67 ; CHECK: br i1 [[R6]] - ; CHECK: [[R8:%[^ ]*]] = getelementptr i8, i8* @bits_use.{{[0-9]*}}, i32 [[R5]] - ; CHECK: [[R9:%[^ ]*]] = load i8, i8* [[R8]] + ; CHECK: [[R8:%[^ ]*]] = getelementptr i8, ptr @bits_use.{{[0-9]*}}, i32 [[R5]] + ; CHECK: [[R9:%[^ ]*]] = load i8, ptr [[R8]] ; CHECK: [[R10:%[^ ]*]] = and i8 [[R9]], 1 ; CHECK: [[R11:%[^ ]*]] = icmp ne i8 [[R10]], 0 ; CHECK: [[R16:%[^ ]*]] = phi i1 [ false, {{%[^ ]*}} ], [ [[R11]], {{%[^ ]*}} ] - %x = call i1 @llvm.type.test(i8* %pi8, metadata !"typeid1") + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ; CHECK-NOT: llvm.type.test - %y = call i1 @llvm.type.test(i8* %pi8, metadata !"typeid1") + %y = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ; CHECK: ret i1 [[R16]] ret i1 %x } -; CHECK: @bar(i32* [[B0:%[^ ]*]]) -define i1 @bar(i32* %p) { - ; CHECK: [[S0:%[^ ]*]] = bitcast i32* [[B0]] to i8* - %pi8 = bitcast i32* %p to i8* - ; CHECK: [[S1:%[^ ]*]] = ptrtoint i8* [[S0]] to i32 - ; CHECK: [[S2:%[^ ]*]] = sub i32 [[S1]], ptrtoint (i8* getelementptr (i8, i8* bitcast ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]] to i8*), i32 4) to i32) +; CHECK: @bar(ptr [[B0:%[^ ]*]]) +define i1 @bar(ptr %p) { + ; CHECK: [[S1:%[^ ]*]] = ptrtoint ptr %p to i32 + ; CHECK: [[S2:%[^ ]*]] = sub i32 [[S1]], ptrtoint (ptr getelementptr (i8, ptr [[G]], i32 4) to i32) ; CHECK: [[S3:%[^ ]*]] = lshr i32 [[S2]], 8 ; CHECK: [[S4:%[^ ]*]] = shl i32 [[S2]], 24 ; CHECK: [[S5:%[^ ]*]] = or i32 [[S3]], [[S4]] ; CHECK: [[S6:%[^ ]*]] = icmp ule i32 [[S5]], 1 - %x = call i1 @llvm.type.test(i8* %pi8, metadata !"typeid2") + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid2") ; CHECK: ret i1 [[S6]] ret i1 %x } -; CHECK: @baz(i32* [[C0:%[^ ]*]]) -define i1 @baz(i32* %p) { - ; CHECK: [[T0:%[^ ]*]] = bitcast i32* [[C0]] to i8* - %pi8 = bitcast i32* %p to i8* - ; CHECK: [[T1:%[^ ]*]] = ptrtoint i8* [[T0]] to i32 - ; CHECK: [[T2:%[^ ]*]] = sub i32 [[T1]], ptrtoint ({ i32, [0 x i8], [63 x i32], [4 x i8], i32, [0 x i8], [2 x i32] }* [[G]] to i32) +; CHECK: @baz(ptr [[C0:%[^ ]*]]) +define i1 @baz(ptr %p) { + ; CHECK: [[T1:%[^ ]*]] = ptrtoint ptr %p to i32 + ; CHECK: [[T2:%[^ ]*]] = sub i32 [[T1]], ptrtoint (ptr [[G]] to i32) ; CHECK: [[T3:%[^ ]*]] = lshr i32 [[T2]], 2 ; CHECK: [[T4:%[^ ]*]] = shl i32 [[T2]], 30 ; CHECK: [[T5:%[^ ]*]] = or i32 [[T3]], [[T4]] ; CHECK: [[T6:%[^ ]*]] = icmp ule i32 [[T5]], 65 ; CHECK: br i1 [[T6]] - ; CHECK: [[T8:%[^ ]*]] = getelementptr i8, i8* @bits_use{{(\.[0-9]*)?}}, i32 [[T5]] - ; CHECK: [[T9:%[^ ]*]] = load i8, i8* [[T8]] + ; CHECK: [[T8:%[^ ]*]] = getelementptr i8, ptr @bits_use{{(\.[0-9]*)?}}, i32 [[T5]] + ; CHECK: [[T9:%[^ ]*]] = load i8, ptr [[T8]] ; CHECK: [[T10:%[^ ]*]] = and i8 [[T9]], 2 ; CHECK: [[T11:%[^ ]*]] = icmp ne i8 [[T10]], 0 ; CHECK: [[T16:%[^ ]*]] = phi i1 [ false, {{%[^ ]*}} ], [ [[T11]], {{%[^ ]*}} ] - %x = call i1 @llvm.type.test(i8* %pi8, metadata !"typeid3") + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid3") ; CHECK: ret i1 [[T16]] ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/simplify.ll b/llvm/test/Transforms/LowerTypeTests/simplify.ll index 1ddb5eaeac315..87eaed5a51f24 100644 --- a/llvm/test/Transforms/LowerTypeTests/simplify.ll +++ b/llvm/test/Transforms/LowerTypeTests/simplify.ll @@ -3,22 +3,22 @@ target datalayout = "e-p:64:64" target triple = "x86_64-unknown-linux" -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone - -; CHECK: define i1 @bytearray7(i8* [[p:%.*]]) -define i1 @bytearray7(i8* %p) { - ; CHECK-NEXT: [[pi:%.*]] = ptrtoint i8* [[p]] to i64 - ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint ([0 x i8]* @__typeid_bytearray7_global_addr to i64) - ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8) to i64) - ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint ([0 x i8]* @__typeid_bytearray7_align to i8)) to i64) +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone + +; CHECK: define i1 @bytearray7(ptr [[p:%.*]]) +define i1 @bytearray7(ptr %p) { + ; CHECK-NEXT: [[pi:%.*]] = ptrtoint ptr [[p]] to i64 + ; CHECK-NEXT: [[sub:%.*]] = sub i64 [[pi]], ptrtoint (ptr @__typeid_bytearray7_global_addr to i64) + ; CHECK-NEXT: [[lshr:%.*]] = lshr i64 [[sub]], zext (i8 ptrtoint (ptr @__typeid_bytearray7_align to i8) to i64) + ; CHECK-NEXT: [[shl:%.*]] = shl i64 [[sub]], zext (i8 sub (i8 64, i8 ptrtoint (ptr @__typeid_bytearray7_align to i8)) to i64) ; CHECK-NEXT: [[or:%.*]] = or i64 [[lshr]], [[shl]] - ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint ([0 x i8]* @__typeid_bytearray7_size_m1 to i64) + ; CHECK-NEXT: [[ule:%.*]] = icmp ule i64 [[or]], ptrtoint (ptr @__typeid_bytearray7_size_m1 to i64) ; CHECK-NEXT: br i1 [[ule]], label %[[t1:.*]], label %[[f:.*]] ; CHECK: [[t1]]: - ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, i8* getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_bytearray7_byte_array, i32 0, i32 0), i64 [[or]] - ; CHECK-NEXT: [[load:%.*]] = load i8, i8* [[gep]] - ; CHECK-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint ([0 x i8]* @__typeid_bytearray7_bit_mask to i8) + ; CHECK-NEXT: [[gep:%.*]] = getelementptr i8, ptr @__typeid_bytearray7_byte_array, i64 [[or]] + ; CHECK-NEXT: [[load:%.*]] = load i8, ptr [[gep]] + ; CHECK-NEXT: [[and:%.*]] = and i8 [[load]], ptrtoint (ptr @__typeid_bytearray7_bit_mask to i8) ; CHECK-NEXT: [[ne:%.*]] = icmp ne i8 [[and]], 0 ; CHECK-NEXT: br i1 [[ne]], label %[[t:.*]], label %[[f:.*]] @@ -27,7 +27,7 @@ define i1 @bytearray7(i8* %p) { ; CHECK: [[f]]: ; CHECK-NEXT: ret i1 false - %x = call i1 @llvm.type.test(i8* %p, metadata !"bytearray7") + %x = call i1 @llvm.type.test(ptr %p, metadata !"bytearray7") br i1 %x, label %t, label %f t: diff --git a/llvm/test/Transforms/LowerTypeTests/simplify_phi.ll b/llvm/test/Transforms/LowerTypeTests/simplify_phi.ll index 0dd16eb1a199a..4764f06fd80dc 100644 --- a/llvm/test/Transforms/LowerTypeTests/simplify_phi.ll +++ b/llvm/test/Transforms/LowerTypeTests/simplify_phi.ll @@ -3,11 +3,11 @@ target datalayout = "e-p:64:64" -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -; CHECK: define i1 @bytearray7(i8* [[p:%.*]]) -define i1 @bytearray7(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"bytearray7") +; CHECK: define i1 @bytearray7(ptr [[p:%.*]]) +define i1 @bytearray7(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"bytearray7") br i1 %x, label %t, label %f t: diff --git a/llvm/test/Transforms/LowerTypeTests/single-offset.ll b/llvm/test/Transforms/LowerTypeTests/single-offset.ll index c7945da3ebf84..0f302286e5702 100644 --- a/llvm/test/Transforms/LowerTypeTests/single-offset.ll +++ b/llvm/test/Transforms/LowerTypeTests/single-offset.ll @@ -10,28 +10,28 @@ target datalayout = "e-p:32:32" !1 = !{i32 0, !"typeid2"} !2 = !{i32 0, !"typeid3"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -; CHECK: @foo(i8* [[A0:%[^ ]*]]) -define i1 @foo(i8* %p) { - ; CHECK: [[R0:%[^ ]*]] = ptrtoint i8* [[A0]] to i32 - ; CHECK: [[R1:%[^ ]*]] = icmp eq i32 [[R0]], ptrtoint ({ i32, [0 x i8], i32 }* [[G]] to i32) - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid2") +; CHECK: @foo(ptr [[A0:%[^ ]*]]) +define i1 @foo(ptr %p) { + ; CHECK: [[R0:%[^ ]*]] = ptrtoint ptr [[A0]] to i32 + ; CHECK: [[R1:%[^ ]*]] = icmp eq i32 [[R0]], ptrtoint (ptr [[G]] to i32) + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid2") ; CHECK: ret i1 [[R1]] ret i1 %x } -; CHECK: @bar(i8* [[B0:%[^ ]*]]) -define i1 @bar(i8* %p) { - ; CHECK: [[S0:%[^ ]*]] = ptrtoint i8* [[B0]] to i32 - ; CHECK: [[S1:%[^ ]*]] = icmp eq i32 [[S0]], ptrtoint (i8* getelementptr (i8, i8* bitcast ({ i32, [0 x i8], i32 }* [[G]] to i8*), i32 4) to i32) - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid3") +; CHECK: @bar(ptr [[B0:%[^ ]*]]) +define i1 @bar(ptr %p) { + ; CHECK: [[S0:%[^ ]*]] = ptrtoint ptr [[B0]] to i32 + ; CHECK: [[S1:%[^ ]*]] = icmp eq i32 [[S0]], ptrtoint (ptr getelementptr (i8, ptr [[G]], i32 4) to i32) + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid3") ; CHECK: ret i1 [[S1]] ret i1 %x } ; CHECK: @x( -define i1 @x(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @x(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/unnamed.ll b/llvm/test/Transforms/LowerTypeTests/unnamed.ll index c5b3cc8c4666f..7d9ba084ff738 100644 --- a/llvm/test/Transforms/LowerTypeTests/unnamed.ll +++ b/llvm/test/Transforms/LowerTypeTests/unnamed.ll @@ -10,9 +10,9 @@ target datalayout = "e-p:32:32" !0 = !{i32 0, !"typeid1"} !1 = !{i32 4, !"typeid1"} -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ret i1 %x } diff --git a/llvm/test/Transforms/LowerTypeTests/unsat.ll b/llvm/test/Transforms/LowerTypeTests/unsat.ll index 9a743f6b2a1a8..0c414a1214bc6 100644 --- a/llvm/test/Transforms/LowerTypeTests/unsat.ll +++ b/llvm/test/Transforms/LowerTypeTests/unsat.ll @@ -2,10 +2,10 @@ target datalayout = "e-p:32:32" -declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone +declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone -define i1 @foo(i8* %p) { - %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1") +define i1 @foo(ptr %p) { + %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1") ; CHECK: ret i1 false ret i1 %x }