[llvm] d5d3eb1 - ThinLTO: Convert tests to opaque pointers

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 19:49:49 PST 2022


Author: Fangrui Song
Date: 2022-11-27T19:49:43-08:00
New Revision: d5d3eb16b7ab72529c83dacb2889811491e48909

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

LOG: ThinLTO: Convert tests to opaque pointers

Added: 
    

Modified: 
    llvm/test/ThinLTO/X86/Inputs/alias_import.ll
    llvm/test/ThinLTO/X86/Inputs/alias_internal.ll
    llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions-import.ll
    llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions2.ll
    llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions3.ll
    llvm/test/ThinLTO/X86/Inputs/callees-metadata.ll
    llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll
    llvm/test/ThinLTO/X86/Inputs/cfi-icall-only-bazqux.ll
    llvm/test/ThinLTO/X86/Inputs/cfi-unsat.ll
    llvm/test/ThinLTO/X86/Inputs/devirt2.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_alias.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_promote.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_bar.ll
    llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_foo.ll
    llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll
    llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll
    llvm/test/ThinLTO/X86/Inputs/dot-dumper.ll
    llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll
    llvm/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll
    llvm/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll
    llvm/test/ThinLTO/X86/Inputs/globals-import.ll
    llvm/test/ThinLTO/X86/Inputs/guid_collision.ll
    llvm/test/ThinLTO/X86/Inputs/import-constant.ll
    llvm/test/ThinLTO/X86/Inputs/import-metadata.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop-cache-foo.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll
    llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll
    llvm/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
    llvm/test/ThinLTO/X86/Inputs/local_name_conflict1.ll
    llvm/test/ThinLTO/X86/Inputs/local_name_conflict2.ll
    llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var1.ll
    llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var2.ll
    llvm/test/ThinLTO/X86/Inputs/module_asm2.ll
    llvm/test/ThinLTO/X86/Inputs/personality.ll
    llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll
    llvm/test/ThinLTO/X86/Inputs/reference_non_importable.ll
    llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
    llvm/test/ThinLTO/X86/Inputs/section.ll
    llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition1.ll
    llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition2.ll
    llvm/test/ThinLTO/X86/Inputs/weak_resolution.ll
    llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll
    llvm/test/ThinLTO/X86/alias-ifunc.ll
    llvm/test/ThinLTO/X86/alias_import.ll
    llvm/test/ThinLTO/X86/alias_internal.ll
    llvm/test/ThinLTO/X86/asm.ll
    llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
    llvm/test/ThinLTO/X86/cfi-distributed.ll
    llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
    llvm/test/ThinLTO/X86/cfi-icall.ll
    llvm/test/ThinLTO/X86/cfi-unsat.ll
    llvm/test/ThinLTO/X86/cfi.ll
    llvm/test/ThinLTO/X86/ctor-dtor-alias.ll
    llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll
    llvm/test/ThinLTO/X86/devirt-after-icp.ll
    llvm/test/ThinLTO/X86/devirt.ll
    llvm/test/ThinLTO/X86/devirt2.ll
    llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll
    llvm/test/ThinLTO/X86/devirt_alias.ll
    llvm/test/ThinLTO/X86/devirt_available_externally.ll
    llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
    llvm/test/ThinLTO/X86/devirt_local_same_guid.ll
    llvm/test/ThinLTO/X86/devirt_multiple_type_test.ll
    llvm/test/ThinLTO/X86/devirt_promote.ll
    llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
    llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
    llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll
    llvm/test/ThinLTO/X86/dicompositetype-unique2.ll
    llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll
    llvm/test/ThinLTO/X86/dot-dumper.ll
    llvm/test/ThinLTO/X86/export.ll
    llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
    llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll
    llvm/test/ThinLTO/X86/funcimport-tbaa.ll
    llvm/test/ThinLTO/X86/globals-import-blockaddr.ll
    llvm/test/ThinLTO/X86/guid_collision.ll
    llvm/test/ThinLTO/X86/import-constant.ll
    llvm/test/ThinLTO/X86/index-const-prop-O0.ll
    llvm/test/ThinLTO/X86/index-const-prop-alias.ll
    llvm/test/ThinLTO/X86/index-const-prop-dead.ll
    llvm/test/ThinLTO/X86/index-const-prop-gvref-pie.ll
    llvm/test/ThinLTO/X86/index-const-prop-gvref.ll
    llvm/test/ThinLTO/X86/index-const-prop-linkage.ll
    llvm/test/ThinLTO/X86/index-const-prop.ll
    llvm/test/ThinLTO/X86/index-const-prop2.ll
    llvm/test/ThinLTO/X86/internalize.ll
    llvm/test/ThinLTO/X86/lazyload_metadata.ll
    llvm/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
    llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
    llvm/test/ThinLTO/X86/llvm.used.ll
    llvm/test/ThinLTO/X86/load-store-caching.ll
    llvm/test/ThinLTO/X86/local_name_conflict.ll
    llvm/test/ThinLTO/X86/module_asm2.ll
    llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
    llvm/test/ThinLTO/X86/noinline.ll
    llvm/test/ThinLTO/X86/personality.ll
    llvm/test/ThinLTO/X86/pr35472.ll
    llvm/test/ThinLTO/X86/promote-local-name.ll
    llvm/test/ThinLTO/X86/reference_non_importable.ll
    llvm/test/ThinLTO/X86/selective-save-temps.ll
    llvm/test/ThinLTO/X86/thinlto-internalize-doublepromoted.ll
    llvm/test/ThinLTO/X86/thinlto-internalize-used.ll
    llvm/test/ThinLTO/X86/tli-nobuiltin.ll
    llvm/test/ThinLTO/X86/visibility-elf.ll
    llvm/test/ThinLTO/X86/visibility-macho.ll
    llvm/test/ThinLTO/X86/weak_externals.ll
    llvm/test/ThinLTO/X86/weak_resolution.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/ThinLTO/X86/Inputs/alias_import.ll b/llvm/test/ThinLTO/X86/Inputs/alias_import.ll
index 740ab4baa3582..bc9b7c06234c4 100644
--- a/llvm/test/ThinLTO/X86/Inputs/alias_import.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/alias_import.ll
@@ -1,60 +1,60 @@
 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 
- at globalfuncAlias = alias void (...), bitcast (void ()* @globalfunc to void (...)*)
- at globalfuncWeakAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
- at globalfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @globalfunc to void (...)*)
- at globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
- at globalfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
+ at globalfuncAlias = alias void (...), ptr @globalfunc
+ at globalfuncWeakAlias = weak alias void (...), ptr @globalfunc
+ at globalfuncLinkonceAlias = linkonce alias void (...), ptr @globalfunc
+ at globalfuncWeakODRAlias = weak_odr alias void (...), ptr @globalfunc
+ at globalfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @globalfunc
 define hidden void @globalfunc() {
 entry:
   ret void
 }
 
- at internalfuncAlias = alias void (...), bitcast (void ()* @internalfunc to void (...)*)
- at internalfuncWeakAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
- at internalfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @internalfunc to void (...)*)
- at internalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
- at internalfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
+ at internalfuncAlias = alias void (...), ptr @internalfunc
+ at internalfuncWeakAlias = weak alias void (...), ptr @internalfunc
+ at internalfuncLinkonceAlias = linkonce alias void (...), ptr @internalfunc
+ at internalfuncWeakODRAlias = weak_odr alias void (...), ptr @internalfunc
+ at internalfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @internalfunc
 define internal void @internalfunc() {
 entry:
   ret void
 }
 
- at linkonceODRfuncAlias = alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
- at linkonceODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
- at linkonceODRfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
- at linkonceODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
- at linkonceODRfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
+ at linkonceODRfuncAlias = alias void (...), ptr @linkonceODRfunc
+ at linkonceODRfuncWeakAlias = weak alias void (...), ptr @linkonceODRfunc
+ at linkonceODRfuncLinkonceAlias = linkonce alias void (...), ptr @linkonceODRfunc
+ at linkonceODRfuncWeakODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
+ at linkonceODRfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @linkonceODRfunc
 define linkonce_odr void @linkonceODRfunc() {
 entry:
   ret void
 }
 
- at weakODRfuncAlias = alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
- at weakODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
- at weakODRfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
- at weakODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
- at weakODRfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
+ at weakODRfuncAlias = alias void (...), ptr @weakODRfunc
+ at weakODRfuncWeakAlias = weak alias void (...), ptr @weakODRfunc
+ at weakODRfuncLinkonceAlias = linkonce alias void (...), ptr @weakODRfunc
+ at weakODRfuncWeakODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+ at weakODRfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @weakODRfunc
 define weak_odr void @weakODRfunc() {
 entry:
   ret void
 }
 
- at linkoncefuncAlias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
- at linkoncefuncWeakAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
- at linkoncefuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
- at linkoncefuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
- at linkoncefuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
+ at linkoncefuncAlias = alias void (...), ptr @linkoncefunc
+ at linkoncefuncWeakAlias = weak alias void (...), ptr @linkoncefunc
+ at linkoncefuncLinkonceAlias = linkonce alias void (...), ptr @linkoncefunc
+ at linkoncefuncWeakODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+ at linkoncefuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @linkoncefunc
 define linkonce void @linkoncefunc() {
 entry:
   ret void
 }
 
- at weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
- at weakfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
- at weakfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @weakfunc to void (...)*)
- at weakfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
- at weakfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
+ at weakfuncAlias = alias void (...), ptr @weakfunc
+ at weakfuncWeakAlias = weak alias void (...), ptr @weakfunc
+ at weakfuncLinkonceAlias = linkonce alias void (...), ptr @weakfunc
+ at weakfuncWeakODRAlias = weak_odr alias void (...), ptr @weakfunc
+ at weakfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @weakfunc
 define weak void @weakfunc() {
 entry:
   ret void

diff  --git a/llvm/test/ThinLTO/X86/Inputs/alias_internal.ll b/llvm/test/ThinLTO/X86/Inputs/alias_internal.ll
index 88bc8335f5eed..11589d889fe06 100644
--- a/llvm/test/ThinLTO/X86/Inputs/alias_internal.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/alias_internal.ll
@@ -1,8 +1,8 @@
 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"
 
-define internal i32 @f(i8*) unnamed_addr {
+define internal i32 @f(ptr) unnamed_addr {
     ret i32 42
 }
 
- at a2 = weak alias i32 (i8*), i32 (i8*)* @f
+ at a2 = weak alias i32 (ptr), ptr @f

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions-import.ll b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions-import.ll
index 2cf9a2d864339..ede39ce5a3621 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions-import.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions-import.ll
@@ -1,15 +1,15 @@
 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"
 
-define i1 @importf1(i8* %p) {
-  %x = call i1 @f1(i8* %p)
+define i1 @importf1(ptr %p) {
+  %x = call i1 @f1(ptr %p)
   ret i1 %x
 }
 
-define i1 @importf2(i8* %p) {
-  %x = call i1 @f2(i8* %p)
+define i1 @importf2(ptr %p) {
+  %x = call i1 @f2(ptr %p)
   ret i1 %x
 }
 
-declare i1 @f1(i8* %p)
-declare i1 @f2(i8* %p)
+declare i1 @f1(ptr %p)
+declare i1 @f2(ptr %p)

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions2.ll b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions2.ll
index 067804293b50b..046983f783cf2 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions2.ll
@@ -1,9 +1,9 @@
 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"
 
- at vt2 = constant i1 (i8*)* @vf2, !type !0
+ at vt2 = constant ptr @vf2, !type !0
 
-define internal i1 @vf2(i8* %this) {
+define internal i1 @vf2(ptr %this) {
   ret i1 0
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions3.ll b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions3.ll
index c3de5205ede5a..8c9a41ecf8f34 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions3.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cache-typeid-resolutions3.ll
@@ -1,14 +1,14 @@
 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"
 
- at vt2a = constant i1 (i8*)* @vf2a, !type !0
- at vt2b = constant i1 (i8*)* @vf2b, !type !0
+ at vt2a = constant ptr @vf2a, !type !0
+ at vt2b = constant ptr @vf2b, !type !0
 
-define internal i1 @vf2a(i8* %this) {
+define internal i1 @vf2a(ptr %this) {
   ret i1 0
 }
 
-define internal i1 @vf2b(i8* %this) {
+define internal i1 @vf2b(ptr %this) {
   ret i1 1
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/callees-metadata.ll b/llvm/test/ThinLTO/X86/Inputs/callees-metadata.ll
index 7718347e3245c..4e77ef2df24ed 100644
--- a/llvm/test/ThinLTO/X86/Inputs/callees-metadata.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/callees-metadata.ll
@@ -1,11 +1,11 @@
 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"
 
- at fptr = internal unnamed_addr global i32 (i32)* @f2, align 8
+ at fptr = internal unnamed_addr global ptr @f2, align 8
 
 define dso_local i32 @foo(i32 %x) local_unnamed_addr {
 entry:
-  %0 = load i32 (i32)*, i32 (i32)** @fptr, align 8
+  %0 = load ptr, ptr @fptr, align 8
   %call = tail call i32 %0(i32 %x), !callees !0
   ret i32 %call
 }
@@ -16,7 +16,7 @@ entry:
   br i1 %tobool, label %if.end, label %if.then
 
 if.then:                                          ; preds = %entry
-  store i32 (i32)* @f1, i32 (i32)** @fptr, align 8
+  store ptr @f1, ptr @fptr, align 8
   %sub.i = add nsw i32 %x, -1
   br label %if.end
 
@@ -31,4 +31,4 @@ entry:
   ret i32 %sub
 }
 
-!0 = !{i32 (i32)* @f1, i32 (i32)* @f2}
+!0 = !{ptr @f1, ptr @f2}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll b/llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll
index 18554a009fc15..2415078e0e712 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cfi-distributed.ll
@@ -2,20 +2,19 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-grtev4-linux-gnu"
 
 %struct.B2 = type { %struct.A2 }
-%struct.A2 = type { i32 (...)** }
+%struct.A2 = type { ptr }
 %struct.B3 = type { %struct.A3 }
-%struct.A3 = type { i32 (...)** }
+%struct.A3 = type { ptr }
 
- at _ZTV1B2 = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+ at _ZTV1B2 = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
 
- at _ZTV1B3 = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !1
+ at _ZTV1B3 = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !1
 
-define void @test2(i8* %b) {
+define void @test2(ptr %b) {
 entry:
-  %0 = bitcast i8* %b to i8**
-  %vtable2 = load i8*, i8** %0
-  %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A2")
-  br i1 %1, label %cont, label %trap
+  %vtable2 = load ptr, ptr %b
+  %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A2")
+  br i1 %0, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
@@ -25,12 +24,11 @@ cont:
   ret void
 }
 
-define void @test1(i8* %b) {
+define void @test1(ptr %b) {
 entry:
-  %0 = bitcast i8* %b to i8**
-  %vtable2 = load i8*, i8** %0
-  %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A3")
-  br i1 %1, label %cont, label %trap
+  %vtable2 = load ptr, ptr %b
+  %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A3")
+  br i1 %0, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
@@ -40,9 +38,9 @@ cont:
   ret void
 }
 
- at test3 = hidden unnamed_addr alias void (i8*), void (i8*)* @test1
+ at test3 = hidden unnamed_addr alias void (ptr), ptr @test1
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.trap()
 
 !0 = !{i64 16, !"_ZTS1A2"}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cfi-icall-only-bazqux.ll b/llvm/test/ThinLTO/X86/Inputs/cfi-icall-only-bazqux.ll
index 94186ae162169..7a3c267362e40 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cfi-icall-only-bazqux.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cfi-icall-only-bazqux.ll
@@ -1,23 +1,23 @@
 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"
 
-declare !type !0 i8 @bar(i8*)
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare !type !0 i8 @bar(ptr)
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
 
-define i8 @baz(i8* %p) !type !0 {
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @baz(ptr %p) !type !0 {
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
   %1 = select i1 %x, i8 0, i8 3
   ret i8 %1
 }
 
-define i8 @qux(i8* %p) !type !0 {
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @qux(ptr %p) !type !0 {
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
   ret i8 4
 }
 
-define i8 @g(i1 %i, i8* %p) {
-  %1 = select i1 %i, i8(i8*)* @bar, i8(i8*)* @qux
-  %2 = call i8 %1(i8* %p)
+define i8 @g(i1 %i, ptr %p) {
+  %1 = select i1 %i, ptr @bar, ptr @qux
+  %2 = call i8 %1(ptr %p)
   ret i8 %2
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/cfi-unsat.ll b/llvm/test/ThinLTO/X86/Inputs/cfi-unsat.ll
index c44acd32f18c6..2e9939457ff4d 100644
--- a/llvm/test/ThinLTO/X86/Inputs/cfi-unsat.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/cfi-unsat.ll
@@ -1,66 +1,62 @@
 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.B = type { i32 (...)** }
+%struct.A = type { ptr }
+%struct.B = type { ptr }
 
- at _ZTV1B = linkonce_odr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1nEi to i8*)] }, !type !0
+ at _ZTV1B = linkonce_odr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, !type !0
 
 $test = comdat any
 $testb = comdat any
 
-define linkonce_odr i32 @test(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @test(ptr %obj, i32 %a) comdat {
 entry:
-  %0 = bitcast %struct.A* %obj to i8**
-  %vtable5 = load i8*, i8** %0
+  %vtable5 = load ptr, ptr %obj
 
-  %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 8, metadata !"_ZTS1A")
-  %2 = extractvalue { i8*, i1 } %1, 1
-  br i1 %2, label %cont, label %trap
+  %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 8, metadata !"_ZTS1A")
+  %1 = extractvalue { ptr, i1 } %0, 1
+  br i1 %1, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
   unreachable
 
 cont:
-  %3 = extractvalue { i8*, i1 } %1, 0
-  %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+  %2 = extractvalue { ptr, i1 } %0, 0
 
-  %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
 
-define linkonce_odr i32 @testb(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @testb(ptr %obj, i32 %a) comdat {
 entry:
-  %0 = bitcast %struct.A* %obj to i8**
-  %vtable5 = load i8*, i8** %0
+  %vtable5 = load ptr, ptr %obj
 
-  %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 0, metadata !"_ZTS1A")
-  %2 = extractvalue { i8*, i1 } %1, 1
-  br i1 %2, label %cont, label %trap
+  %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 0, metadata !"_ZTS1A")
+  %1 = extractvalue { ptr, i1 } %0, 1
+  br i1 %1, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
   unreachable
 
 cont:
-  %3 = extractvalue { i8*, i1 } %1, 0
-  %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+  %2 = extractvalue { ptr, i1 } %0, 0
 
-  %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
 
-declare { i8*, i1 } @llvm.type.checked.load(i8*, i32, metadata)
+declare { ptr, i1 } @llvm.type.checked.load(ptr, i32, metadata)
 declare void @llvm.trap()
 
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) {
 entry:
    ret i32 0
 }
-define internal i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) {
+define internal i32 @_ZN1B1nEi(ptr %this, i32 %a) {
 entry:
    ret i32 0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt2.ll b/llvm/test/ThinLTO/X86/Inputs/devirt2.ll
index 9b6652886cefe..b248d774b10fe 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt2.ll
@@ -1,55 +1,52 @@
 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 }
-%struct.D = type { i32 (...)** }
-%struct.E = type { i32 (...)** }
+%struct.D = type { ptr }
+%struct.E = type { ptr }
 
- at _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
- at _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
- at _ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
- at _ZTV1E = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.E*, i32)* @_ZN1E1mEi to i8*)] }, !type !4
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
+ at _ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2
+ at _ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
+ at _ZTV1E = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1E1mEi] }, !type !4
 
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal 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
 }
 
-define linkonce_odr i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 
-define internal i32 @_ZN1E1mEi(%struct.E* %this, i32 %a) #0 {
+define internal i32 @_ZN1E1mEi(ptr %this, i32 %a) #0 {
    ret i32 0, !dbg !12
 }
 
-define i32 @test2(%struct.E* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
 entry:
-  %0 = bitcast %struct.E* %obj to i8***, !dbg !12
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1E")
+  %vtable2 = load ptr, ptr %obj
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1E")
   call void @llvm.assume(i1 %p2)
 
-  %2 = bitcast i8** %vtable2 to i32 (%struct.E*, i32)**
-  %fptr33 = load i32 (%struct.E*, i32)*, i32 (%struct.E*, i32)** %2, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
-  %call4 = tail call i32 %fptr33(%struct.E* nonnull %obj, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
   ret i32 %call4
 }
 
 attributes #0 = { noinline optnone }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !llvm.dbg.cu = !{!5}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll
index da7bd0170d956..e52682f1a1f7d 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_after_filtering_unreachable_lib.ll
@@ -4,33 +4,30 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 %Derived = type { %Base }
-%Base = type { i32 (...)** }
+%Base = type { ptr }
 
- at _ZTV7Derived = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%Derived*)* @_ZN7DerivedD0Ev to i8*)] }, !type !0, !type !1, !vcall_visibility !2
- at _ZTV4Base = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%Base*)* @_ZN4BaseD0Ev to i8*)] }, !type !0, !vcall_visibility !2
+ at _ZTV7Derived = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN7DerivedD0Ev] }, !type !0, !type !1, !vcall_visibility !2
+ at _ZTV4Base = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN4BaseD0Ev] }, !type !0, !vcall_visibility !2
 
-define void @_Z3fooP4Base(%Base* %b) {
+define void @_Z3fooP4Base(ptr %b) {
 entry:
-  %0 = bitcast %Base* %b to void (%Base*)***
-  %vtable = load void (%Base*)**, void (%Base*)*** %0
-  %1 = bitcast void (%Base*)** %vtable to i8*
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS4Base")
-  tail call void @llvm.assume(i1 %2)
-  %vfn = getelementptr inbounds void (%Base*)*, void (%Base*)** %vtable, i64 0
-  %3 = load void (%Base*)*, void (%Base*)** %vfn
-  tail call void %3(%Base* %b)
+  %vtable = load ptr, ptr %b
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS4Base")
+  tail call void @llvm.assume(i1 %0)
+  %1 = load ptr, ptr %vtable
+  tail call void %1(ptr %b)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 declare void @llvm.assume(i1)
 
-define void @_ZN7DerivedD0Ev(%Derived* %this) {
+define void @_ZN7DerivedD0Ev(ptr %this) {
   ret void
 }
 
-define void @_ZN4BaseD0Ev(%Base* %this) {
+define void @_ZN4BaseD0Ev(ptr %this) {
   unreachable
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_alias.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_alias.ll
index 869751b401494..804d3b7615c4d 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_alias.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_alias.ll
@@ -1,12 +1,12 @@
 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.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at some_name = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
- at _ZTV1D = alias { [3 x i8*] }, { [3 x i8*] }* @some_name
+ at some_name = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
+ at _ZTV1D = alias { [3 x ptr] }, ptr @some_name
 
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll
index 56d6ea5fc997d..568b3376196c9 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_available_externally.ll
@@ -1,11 +1,11 @@
 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.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+ at _ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
 
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll
index a255639260119..f56c4bf236761 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_external_comdat_same_guid.ll
@@ -3,40 +3,37 @@ target triple = "x86_64-grtev4-linux-gnu"
 
 source_filename = "-"
 
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 %struct.B = type { %struct.A }
 
 $_ZTV1B = comdat any
 
- at _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*)] }, comdat, !type !0, !type !1
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, comdat, !type !0, !type !1
 
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
    ret i32 0;
 }
 
-define i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
    ret i32 0;
 }
 
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
 entry:
-  %0 = bitcast %struct.B* %obj to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+  %vtable2 = load ptr, ptr %obj
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
   call void @llvm.assume(i1 %p2)
 
-  %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
-  %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
-  %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+  %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+  %fptr33 = load ptr, ptr %fptrptr, align 8
 
-  %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
   ret i32 %call4
 }
 
 attributes #0 = { noinline optnone }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i64 16, !"_ZTS1A"}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll
index cf3d024c32a8c..e8c4adc5a2b21 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_local_same_guid.ll
@@ -3,38 +3,35 @@ target triple = "x86_64-grtev4-linux-gnu"
 
 source_filename = "-"
 
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 %struct.B = type { %struct.A }
 
- at _ZTV1B = internal 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
+ at _ZTV1B = internal constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
 
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
 entry:
-  %0 = bitcast %struct.B* %obj to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+  %vtable2 = load ptr, ptr %obj
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
   call void @llvm.assume(i1 %p2)
 
-  %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
-  %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
-  %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+  %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+  %fptr33 = load ptr, ptr %fptrptr, align 8
 
-  %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
   ret i32 %call4
 }
 
 attributes #0 = { noinline optnone }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i64 16, !"_ZTS1A"}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_promote.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_promote.ll
index bcd49aefe1585..7f87fc54e7537 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_promote.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_promote.ll
@@ -1,38 +1,35 @@
 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 }
 
- at _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
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
 
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
 entry:
-  %0 = bitcast %struct.B* %obj to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+  %vtable2 = load ptr, ptr %obj
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
   call void @llvm.assume(i1 %p2)
 
-  %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
-  %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
-  %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+  %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+  %fptr33 = load ptr, ptr %fptrptr, align 8
 
-  %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
   ret i32 %call4
 }
 
 attributes #0 = { noinline optnone }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i64 16, !"_ZTS1A"}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_bar.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_bar.ll
index 414e7d5dda35c..721d6efb7b53f 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_bar.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_bar.ll
@@ -3,7 +3,7 @@ source_filename = "bar.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.A = type { i32 (...)** }
+%struct.A = type { ptr }
 
 $_ZNK1A1fEv = comdat any
 
@@ -13,35 +13,33 @@ $_ZTS1A = comdat any
 
 $_ZTI1A = comdat any
 
- at _ZTV1A = linkonce_odr hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (i32 (%struct.A*)* @_ZNK1A1fEv to i8*)] }, comdat, align 8, !type !0, !type !1
- at _ZTVN10__cxxabiv117__class_type_infoE = external dso_local global i8*
+ at _ZTV1A = linkonce_odr hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr @_ZTI1A, ptr @_ZNK1A1fEv] }, comdat, align 8, !type !0, !type !1
+ at _ZTVN10__cxxabiv117__class_type_infoE = external dso_local global ptr
 @_ZTS1A = linkonce_odr hidden constant [3 x i8] c"1A\00", comdat, align 1
- at _ZTI1A = linkonce_odr hidden constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }, comdat, align 8
+ at _ZTI1A = linkonce_odr hidden constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS1A }, comdat, align 8
 
 ; Function Attrs: uwtable
 define hidden i32 @_Z3barv() local_unnamed_addr #0 {
 entry:
   %b = alloca %struct.A, align 8
-  %0 = bitcast %struct.A* %b to i8*
-  call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0)
-  %1 = getelementptr inbounds %struct.A, %struct.A* %b, i64 0, i32 0
-  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTV1A, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %1, align 8, !tbaa !4
-  %call = call i32 @_Z3fooP1A(%struct.A* nonnull %b)
+  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b)
+  store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV1A, i64 0, inrange i32 0, i64 2), ptr %b, align 8, !tbaa !4
+  %call = call i32 @_Z3fooP1A(ptr nonnull %b)
   %add = add nsw i32 %call, 10
-  call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #4
+  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
   ret i32 %add
 }
 
 ; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
 
-declare dso_local i32 @_Z3fooP1A(%struct.A*) local_unnamed_addr
+declare dso_local i32 @_Z3fooP1A(ptr) local_unnamed_addr
 
 ; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
 
 ; Function Attrs: nounwind uwtable
-define linkonce_odr hidden i32 @_ZNK1A1fEv(%struct.A* %this) unnamed_addr comdat align 2 {
+define linkonce_odr hidden i32 @_ZNK1A1fEv(ptr %this) unnamed_addr comdat align 2 {
 entry:
   ret i32 3
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_foo.ll b/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_foo.ll
index d29f74b5658ec..2c412c6ed0a23 100644
--- a/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_foo.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/devirt_single_hybrid_foo.ll
@@ -3,24 +3,22 @@ source_filename = "foo.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.A = type { i32 (...)** }
+%struct.A = type { ptr }
 
 ; Function Attrs: uwtable
-define hidden i32 @_Z3fooP1A(%struct.A* %pA) local_unnamed_addr {
+define hidden i32 @_Z3fooP1A(ptr %pA) local_unnamed_addr {
 entry:
-  %0 = bitcast %struct.A* %pA to i32 (%struct.A*)***
-  %vtable = load i32 (%struct.A*)**, i32 (%struct.A*)*** %0, align 8, !tbaa !2
-  %1 = bitcast i32 (%struct.A*)** %vtable to i8*
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
-  tail call void @llvm.assume(i1 %2)
-  %3 = load i32 (%struct.A*)*, i32 (%struct.A*)** %vtable, align 8
-  %call = tail call i32 %3(%struct.A* %pA)
+  %vtable = load ptr, ptr %pA, align 8, !tbaa !2
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
+  tail call void @llvm.assume(i1 %0)
+  %1 = load ptr, ptr %vtable, align 8
+  %call = tail call i32 %1(ptr %pA)
   %add = add nsw i32 %call, 10
   ret i32 %add
 }
 
 ; Function Attrs: nounwind readnone willreturn
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 ; Function Attrs: nounwind willreturn
 declare void @llvm.assume(i1)

diff  --git a/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll b/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll
index ee1c272d39734..d6d484aae7315 100644
--- a/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique-alias.ll
@@ -5,18 +5,17 @@ target triple = "x86_64-scei-ps4"
 %struct.Vec = type { i8 }
 %struct.S = type { i8 }
 
- at _ZN4CFVSD1Ev = alias void (%struct.CFVS*), void (%struct.CFVS*)* @_ZN4CFVSD2Ev
+ at _ZN4CFVSD1Ev = alias void (ptr), ptr @_ZN4CFVSD2Ev
 
-define void @_ZN4CFVSD2Ev(%struct.CFVS* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN4CFVSD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
 entry:
-  %this.addr = alloca %struct.CFVS*, align 8
-  store %struct.CFVS* %this, %struct.CFVS** %this.addr, align 8
-  %this1 = load %struct.CFVS*, %struct.CFVS** %this.addr, align 8
-  %m_val = getelementptr inbounds %struct.CFVS, %struct.CFVS* %this1, i32 0, i32 0
+  %this.addr = alloca ptr, align 8
+  store ptr %this, ptr %this.addr, align 8
+  %this1 = load ptr, ptr %this.addr, align 8
   ret void
 }
 
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5, !6}

diff  --git a/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll b/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll
index 1d2f584975ef6..2792ab5837590 100644
--- a/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/dicompositetype-unique2.ll
@@ -5,16 +5,15 @@ target triple = "x86_64-scei-ps4"
 %struct.Vec = type { i8 }
 %struct.S = type { i8 }
 
-define void @_ZN4CFVSD2Ev(%struct.CFVS* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN4CFVSD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
 entry:
-  %this.addr = alloca %struct.CFVS*, align 8
-  store %struct.CFVS* %this, %struct.CFVS** %this.addr, align 8
-  %this1 = load %struct.CFVS*, %struct.CFVS** %this.addr, align 8
-  %m_val = getelementptr inbounds %struct.CFVS, %struct.CFVS* %this1, i32 0, i32 0
+  %this.addr = alloca ptr, align 8
+  store ptr %this, ptr %this.addr, align 8
+  %this1 = load ptr, ptr %this.addr, align 8
   ret void
 }
 
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5, !6}
@@ -34,7 +33,7 @@ declare dereferenceable(1) %struct.S* @_Z3Getv()
 !13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Vec<&Get>", file: !10, line: 4, size: 8, elements: !14, templateParams: !19, identifier: "_ZTS3VecIXadL_Z3GetvEEE")
 !14 = !{!35}
 !19 = !{!20}
-!20 = !DITemplateValueParameter(name: "F", type: !21, value: %struct.S* ()* @_Z3Getv)
+!20 = !DITemplateValueParameter(name: "F", type: !21, value: ptr @_Z3Getv)
 !21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64)
 !22 = !DIDerivedType(tag: DW_TAG_typedef, name: "Func", file: !10, line: 2, baseType: !23)
 !23 = !DISubroutineType(types: !24)

diff  --git a/llvm/test/ThinLTO/X86/Inputs/dot-dumper.ll b/llvm/test/ThinLTO/X86/Inputs/dot-dumper.ll
index cc4b21e4ea55a..4288d4bb05101 100644
--- a/llvm/test/ThinLTO/X86/Inputs/dot-dumper.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/dot-dumper.ll
@@ -6,8 +6,8 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: norecurse nounwind readonly uwtable
 define i32 @foo() local_unnamed_addr #0 {
-  %1 = load i32, i32* @B, align 4
-  %2 = load i32, i32* @A, align 4
+  %1 = load i32, ptr @B, align 4
+  %2 = load i32, ptr @A, align 4
   %3 = add nsw i32 %2, %1
   ret i32 %3
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll b/llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll
index ad9c48597b9a8..2efdcccb9e8dc 100644
--- a/llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/drop-debug-info.ll
@@ -9,7 +9,7 @@ target triple = "x86_64-apple-macosx10.11.0"
 
 define void @globalfunc() {
 entry:
-  %0 = load i8, i8* @argc, align 1
+  %0 = load i8, ptr @argc, align 1
   tail call void @llvm.dbg.value(metadata i8 %0, i64 0, metadata !19, metadata !29), !dbg !DILocation(scope: !13)
   ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll b/llvm/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll
index 4ecfa7886b5ac..038a3f2ef4a90 100644
--- a/llvm/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll
@@ -4,8 +4,8 @@ target triple = "x86_64-apple-macosx10.11.0"
 
 define i32 @main() {
 entry:
-  %unused = call float @globalfunc1(i32* null, float*null)
+  %unused = call float @globalfunc1(ptr null, ptr null)
   ret i32 0
 }
 
-declare float @globalfunc1(i32*, float*)
\ No newline at end of file
+declare float @globalfunc1(ptr, ptr)
\ No newline at end of file

diff  --git a/llvm/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll b/llvm/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll
index 62c037dae3db0..814caf6d89825 100644
--- a/llvm/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll
@@ -1,17 +1,17 @@
 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"
 
- at label_addr = internal constant [1 x i8*] [i8* blockaddress(@bar, %lb)], align 8
+ at label_addr = internal constant [1 x ptr] [ptr blockaddress(@bar, %lb)], align 8
 
 ; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local [1 x i8*]* @foo() {
-  ret [1 x i8*]* @label_addr
+define dso_local ptr @foo() {
+  ret ptr @label_addr
 }
 
 ; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local [1 x i8*]* @bar() {
+define dso_local ptr @bar() {
   br label %lb
 
 lb:
-  ret [1 x i8*]* @label_addr
+  ret ptr @label_addr
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/globals-import.ll b/llvm/test/ThinLTO/X86/Inputs/globals-import.ll
index ec4ff6eb33845..8a8583321cea2 100644
--- a/llvm/test/ThinLTO/X86/Inputs/globals-import.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/globals-import.ll
@@ -4,6 +4,6 @@ target triple = "x86_64-pc-linux-gnu"
 @baz = internal constant i32 10, align 4
 
 define linkonce_odr i32 @foo() {
-  %1 = load i32, i32* @baz, align 4
+  %1 = load i32, ptr @baz, align 4
   ret i32 %1
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/guid_collision.ll b/llvm/test/ThinLTO/X86/Inputs/guid_collision.ll
index 3d46c7b53716b..38da23e758e67 100644
--- a/llvm/test/ThinLTO/X86/Inputs/guid_collision.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/guid_collision.ll
@@ -7,9 +7,9 @@ define internal fastcc i64 @F() {
   ret i64 0
 }
 
- at llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
+ at llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer
 
 define i64 @G() {
-  ;%1 = load i32, i32* @dummy2, align 4
+  ;%1 = load i32, ptr @dummy2, align 4
   ret i64 0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/import-constant.ll b/llvm/test/ThinLTO/X86/Inputs/import-constant.ll
index dce788ace1c97..c6c729ec0bb96 100644
--- a/llvm/test/ThinLTO/X86/Inputs/import-constant.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/import-constant.ll
@@ -1,15 +1,15 @@
 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.S = type { i32, i32, i32* }
-%struct.Q = type { %struct.S* }
+%struct.S = type { i32, i32, ptr }
+%struct.Q = type { ptr }
 
 @val = dso_local global i32 42, align 4
- at _ZL3Obj = internal constant %struct.S { i32 4, i32 8, i32* @val }, align 8
- at outer = dso_local local_unnamed_addr global %struct.Q { %struct.S* @_ZL3Obj }, align 8
+ at _ZL3Obj = internal constant %struct.S { i32 4, i32 8, ptr @val }, align 8
+ at outer = dso_local local_unnamed_addr global %struct.Q { ptr @_ZL3Obj }, align 8
 
-define dso_local nonnull %struct.S* @_Z6getObjv() local_unnamed_addr {
+define dso_local nonnull ptr @_Z6getObjv() local_unnamed_addr {
 entry:
-  store %struct.S* null, %struct.S** getelementptr inbounds (%struct.Q, %struct.Q* @outer, i64 1, i32 0), align 8
-  ret %struct.S* @_ZL3Obj
+  store ptr null, ptr getelementptr inbounds (%struct.Q, ptr @outer, i64 1, i32 0), align 8
+  ret ptr @_ZL3Obj
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/import-metadata.ll b/llvm/test/ThinLTO/X86/Inputs/import-metadata.ll
index d8be887928a2d..bab5dacfcb797 100644
--- a/llvm/test/ThinLTO/X86/Inputs/import-metadata.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/import-metadata.ll
@@ -4,9 +4,9 @@ target triple = "x86_64-scei-ps4"
 define i32 @foo(i32 %goo) {
 entry:
   %goo.addr = alloca i32, align 4
-  store i32 %goo, i32* %goo.addr, align 4
-  %0 = load i32, i32* %goo.addr, align 4
-  %1 = load i32, i32* %goo.addr, align 4
+  store i32 %goo, ptr %goo.addr, align 4
+  %0 = load i32, ptr %goo.addr, align 4
+  %1 = load i32, ptr %goo.addr, align 4
   %mul = mul nsw i32 %0, %1
   ret i32 %mul
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll
index 8d76b450c8a85..cfb7d5b64a055 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-alias.ll
@@ -2,4 +2,4 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 @g = global i32 42, align 4
- at g.alias = weak alias i32, i32* @g
+ at g.alias = weak alias i32, ptr @g

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-cache-foo.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-cache-foo.ll
index a306b5a3491fd..58fb47f947c55 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-cache-foo.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-cache-foo.ll
@@ -5,14 +5,14 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; Function Attrs: norecurse nounwind readonly ssp uwtable
 define i32 @foo() local_unnamed_addr {
-  %1 = load i32, i32* @gFoo, align 4
+  %1 = load i32, ptr @gFoo, align 4
   ret i32 %1
 }
 
 ; Function Attrs: nounwind ssp uwtable
 define void @bar() local_unnamed_addr {
   %1 = tail call i32 @rand()
-  store i32 %1, i32* @gFoo, align 4
+  store i32 %1, ptr @gFoo, align 4
   ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll
index df57a897b72cd..ad14dd7b18751 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-full-lto.ll
@@ -4,7 +4,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @g = external global i32
 
 define i32 @foo() {
-  %v = load i32, i32* @g
+  %v = load i32, ptr @g
   ret i32 %v
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll
index 28a58b306af5c..480faaac75a39 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-gvref.ll
@@ -1,5 +1,5 @@
 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"
 
- at b = dso_local global i32* @a, align 8
+ at b = dso_local global ptr @a, align 8
 @a = dso_local global i32 42, align 4

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll
index 7f74ca67113f2..b59243207400c 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop-linkage.ll
@@ -6,9 +6,9 @@ target triple = "x86_64-unknown-linux-gnu"
 @g3 = available_externally global i32 42, align 4
 
 define i32 @foo() {
-  %v1 = load i32, i32* @g1
-  %v2 = load i32, i32* @g2
-  %v3 = load i32, i32* @g3
+  %v1 = load i32, ptr @g1
+  %v2 = load i32, ptr @g2
+  %v3 = load i32, ptr @g3
   %s1 = add i32 %v1, %v2
   %s2 = add i32 %s1, %v3
   ret i32 %s2

diff  --git a/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll b/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll
index 90e1763349cda..55d3bd628c227 100644
--- a/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/index-const-prop.ll
@@ -6,21 +6,21 @@ target triple = "x86_64-pc-linux-gnu"
 
 ; Function Attrs: norecurse nounwind readonly
 define i32 @foo() local_unnamed_addr #0 !dbg !14 {
-  %1 = load i32, i32* @gFoo, align 4, !dbg !17
+  %1 = load i32, ptr @gFoo, align 4, !dbg !17
   ret i32 %1, !dbg !18
 }
 
 ; Function Attrs: norecurse nounwind readonly
 define i32 @bar() local_unnamed_addr #0 !dbg !19 {
-  %1 = load i32, i32* @gBar, align 4, !dbg !20
+  %1 = load i32, ptr @gBar, align 4, !dbg !20
   ret i32 %1, !dbg !21
 }
 
 define void @baz() local_unnamed_addr !dbg !22 {
   %1 = tail call i32 @rand(), !dbg !25
-  store i32 %1, i32* @gFoo, align 4, !dbg !26
+  store i32 %1, ptr @gFoo, align 4, !dbg !26
   %2 = tail call i32 @rand(), !dbg !27
-  store i32 %2, i32* @gBar, align 4, !dbg !28
+  store i32 %2, ptr @gBar, align 4, !dbg !28
   ret void, !dbg !29
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll b/llvm/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
index f5b3130fd1520..736f88841a6d2 100644
--- a/llvm/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/linkonce_resolution_comdat.ll
@@ -6,7 +6,7 @@ $g = comdat any
 
 @g_private = private global i32 41, comdat($g)
 
-define linkonce_odr i32 @f(i8*) unnamed_addr comdat($f) {
+define linkonce_odr i32 @f(ptr) unnamed_addr comdat($f) {
     ret i32 41
 }
 
@@ -19,6 +19,6 @@ define internal void @g_internal() unnamed_addr comdat($g) {
 }
 
 define i32 @h() {
-    %i = call i32 @f(i8* null)
+    %i = call i32 @f(ptr null)
     ret i32 %i
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict1.ll b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict1.ll
index de43b7825b9d4..b0810a5e53683 100644
--- a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict1.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict1.ll
@@ -15,6 +15,6 @@ entry:
 ; Function Attrs: noinline nounwind uwtable
 define internal i32 @foo() {
 entry:
-  %0 = load i32, i32* @baz, align 4
+  %0 = load i32, ptr @baz, align 4
   ret i32 %0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict2.ll b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict2.ll
index 7e2412af20faa..906d689b0feff 100644
--- a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict2.ll
@@ -15,6 +15,6 @@ entry:
 ; Function Attrs: noinline nounwind uwtable
 define internal i32 @foo() {
 entry:
-  %0 = load i32, i32* @baz, align 4
+  %0 = load i32, ptr @baz, align 4
   ret i32 %0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var1.ll b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var1.ll
index bec5f67f594df..3a1fa68927970 100644
--- a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var1.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var1.ll
@@ -8,6 +8,6 @@ target triple = "x86_64-unknown-linux-gnu"
 ; Function Attrs: noinline nounwind uwtable
 define i32 @a() {
 entry:
-  %0 = load i32, i32* @baz, align 4
+  %0 = load i32, ptr @baz, align 4
   ret i32 %0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var2.ll b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var2.ll
index 51cd0bef0955f..3420bfda2f4e5 100644
--- a/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/local_name_conflict_var2.ll
@@ -8,6 +8,6 @@ target triple = "x86_64-unknown-linux-gnu"
 ; Function Attrs: noinline nounwind uwtable
 define i32 @b() {
 entry:
-  %0 = load i32, i32* @baz, align 4
+  %0 = load i32, ptr @baz, align 4
   ret i32 %0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/module_asm2.ll b/llvm/test/ThinLTO/X86/Inputs/module_asm2.ll
index f5ff45178d19e..97fba2d124cb2 100644
--- a/llvm/test/ThinLTO/X86/Inputs/module_asm2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/module_asm2.ll
@@ -1,7 +1,7 @@
 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"
 
-define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {
+define i32 @main({ i64, ptr } %unnamed) #0 {
   %1 = call i32 @func1() #1
   %2 = call i32 @func2() #1
   %3 = call i32 @func3() #1

diff  --git a/llvm/test/ThinLTO/X86/Inputs/personality.ll b/llvm/test/ThinLTO/X86/Inputs/personality.ll
index c97b5038639be..80a14d627b94b 100644
--- a/llvm/test/ThinLTO/X86/Inputs/personality.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/personality.ll
@@ -1,18 +1,18 @@
 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-pc-linux-gnu"
 
-define void @bar() personality i32 (i32, i32, i64, i8*, i8*)* @personality_routine {
+define void @bar() personality ptr @personality_routine {
  ret void
 }
 
-define protected i32 @personality_routine(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine(i32, i32, i64, ptr, ptr) {
   ret i32 0
 }
 
-define protected i32 @personality_routine2(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine2(i32, i32, i64, ptr, ptr) {
   ret i32 0
 }
 
-define protected i32 @personality_routine3(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine3(i32, i32, i64, ptr, ptr) {
   ret i32 0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll b/llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll
index 5e161fb182102..b951278c0ee97 100644
--- a/llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/promote-local-name-1.ll
@@ -15,6 +15,6 @@ entry:
 ; Function Attrs: noinline nounwind uwtable
 define internal i32 @foo() {
 entry:
-  %0 = load i32, i32* @baz, align 4
+  %0 = load i32, ptr @baz, align 4
   ret i32 %0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/reference_non_importable.ll b/llvm/test/ThinLTO/X86/Inputs/reference_non_importable.ll
index 66289663a0dcc..1c9929838f791 100644
--- a/llvm/test/ThinLTO/X86/Inputs/reference_non_importable.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/reference_non_importable.ll
@@ -1,8 +1,8 @@
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.11.0"
 
-declare i8 **@foo()
+declare ptr at foo()
 define i32 @main() {
-    call i8 **@foo()
+    call ptr at foo()
 	ret i32 0
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll b/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
index 205308ba234cb..212de765e6127 100644
--- a/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/referenced_by_constant.ll
@@ -10,13 +10,13 @@ define internal void @localreferencedbyglobal() {
     ret void
 }
 
- at someglobal = internal unnamed_addr constant i8* bitcast (void ()* @referencedbyglobal to i8*)
- at someglobal2 = internal unnamed_addr constant i8* bitcast (void ()* @localreferencedbyglobal to i8*)
- at ptr = global i8** null
- at ptr2 = global i8** null
+ at someglobal = internal unnamed_addr constant ptr @referencedbyglobal
+ at someglobal2 = internal unnamed_addr constant ptr @localreferencedbyglobal
+ at ptr = global ptr null
+ at ptr2 = global ptr null
 
 define  void @bar() #0 align 2 {
-  store i8** getelementptr inbounds (i8*, i8** @someglobal, i64 0) , i8*** @ptr, align 8
-  store i8** getelementptr inbounds (i8*, i8** @someglobal2, i64 0) , i8*** @ptr2, align 8
+  store ptr @someglobal , ptr @ptr, align 8
+  store ptr @someglobal2 , ptr @ptr2, align 8
   ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/Inputs/section.ll b/llvm/test/ThinLTO/X86/Inputs/section.ll
index a1e969a3d6cba..243c8eca3c4cb 100644
--- a/llvm/test/ThinLTO/X86/Inputs/section.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/section.ll
@@ -4,7 +4,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
 
 ; @reference_gv_with_section() can't be imported
 define i32 @reference_gv_with_section() {
-    %res = load i32, i32* @var_with_section
+    %res = load i32, ptr @var_with_section
     ret i32 %res
 }
 

diff  --git a/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition1.ll b/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition1.ll
index cc19b038b0634..410c82524e8a7 100644
--- a/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition1.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition1.ll
@@ -1,5 +1,5 @@
 
- at foo = weak alias i32 (...), bitcast (i32 ()* @foo1 to i32 (...)*)
+ at foo = weak alias i32 (...), @foo1
 
 define i32 @foo1() {
     ret i32 42

diff  --git a/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition2.ll b/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition2.ll
index 9c5c0386e0f10..da3a7423bec25 100644
--- a/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition2.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/select_right_alias_definition2.ll
@@ -1,5 +1,5 @@
 
- at foo = alias i32 (...), bitcast (i32 ()* @foo2 to i32 (...)*)
+ at foo = alias i32 (...), @foo2
 
 define linkonce_odr i32 @foo2() {
     %ret = add i32 42, 42

diff  --git a/llvm/test/ThinLTO/X86/Inputs/weak_resolution.ll b/llvm/test/ThinLTO/X86/Inputs/weak_resolution.ll
index 9ef7cbb0986bc..25f9bcf661338 100644
--- a/llvm/test/ThinLTO/X86/Inputs/weak_resolution.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/weak_resolution.ll
@@ -2,10 +2,10 @@ target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-apple-macosx10.11.0"
 
 ; Alias are not optimized
- at linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
+ at linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
 
 ; Alias are not optimized
- at linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
+ at linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
 
 ; Function with an alias are not optimized
 define linkonce_odr void @linkonceodrfuncwithalias() #0 {

diff  --git a/llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll b/llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll
index 31ca2ad9fc55d..aef621eedcfe1 100644
--- a/llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll
+++ b/llvm/test/ThinLTO/X86/Inputs/writeonly-with-refs.ll
@@ -4,14 +4,14 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 %struct.S = type { i32 }
-%struct.Q = type { %struct.S* }
+%struct.Q = type { ptr }
 
 @_ZL3Obj = internal constant %struct.S { i32 42 }, align 4
- at outer = dso_local local_unnamed_addr global %struct.Q { %struct.S* @_ZL3Obj }, align 8
+ at outer = dso_local local_unnamed_addr global %struct.Q { ptr @_ZL3Obj }, align 8
 
 ; Function Attrs: nofree norecurse nounwind uwtable writeonly
 define dso_local void @_Z3foov() local_unnamed_addr {
 entry:
-  store %struct.S* null, %struct.S** getelementptr inbounds (%struct.Q, %struct.Q* @outer, i64 0, i32 0), align 8
+  store ptr null, ptr @outer, align 8
   ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/alias-ifunc.ll b/llvm/test/ThinLTO/X86/alias-ifunc.ll
index 3ec0466100daf..2c19621587328 100644
--- a/llvm/test/ThinLTO/X86/alias-ifunc.ll
+++ b/llvm/test/ThinLTO/X86/alias-ifunc.ll
@@ -22,9 +22,9 @@ target triple = "x86_64-unknown-linux-gnu"
 @foo = ifunc i32 (i32), ptr @foo_resolver
 ; CHECK-RESOLVER:      (name: "foo_resolver"
 ; CHECK-RESOLVER-SAME: live: 1
-define internal i32 (i32)* @foo_resolver() {
+define internal ptr @foo_resolver() {
 entry:
-  ret i32 (i32)* null
+  ret ptr null
 }
 ; CHECK-BAR:      (name: "bar"
 ; CHECK-BAR-NOT:  summaries: (
@@ -43,7 +43,7 @@ entry:
 
 ; CHECK-QUUX:      (name: "quux"
 ; CHECK-QUUX-SAME: live: 1
- at quux = internal alias i32 (i32)* (), ptr @foo_resolver
+ at quux = internal alias ptr (), ptr @foo_resolver
 @quuz = internal ifunc i32 (i32), ptr @quux
 
 ; CHECK-CORGE:      (name: "corge"

diff  --git a/llvm/test/ThinLTO/X86/alias_import.ll b/llvm/test/ThinLTO/X86/alias_import.ll
index 6c6716a958de5..bc5e3ec4c20e8 100644
--- a/llvm/test/ThinLTO/X86/alias_import.ll
+++ b/llvm/test/ThinLTO/X86/alias_import.ll
@@ -7,36 +7,36 @@
 ; Alias can't point to "available_externally", so they are implemented by
 ; importing the alias as an available_externally definition copied from the
 ; aliasee's body.
-; PROMOTE-DAG: @globalfuncAlias = alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncWeakAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncAlias = alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncWeakAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncAlias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncWeakAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncAlias = alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncAlias = alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
+; PROMOTE-DAG: @globalfuncAlias = alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncWeakAlias = weak alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncLinkonceAlias = weak alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncWeakODRAlias = weak_odr alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncLinkonceODRAlias = weak_odr alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @internalfuncAlias = alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncWeakAlias = weak alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncLinkonceAlias = weak alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncWeakODRAlias = weak_odr alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncLinkonceODRAlias = weak_odr alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @linkoncefuncAlias = alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncWeakAlias = weak alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncLinkonceAlias = weak alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncWeakODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncLinkonceODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @weakfuncAlias = alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncWeakAlias = weak alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncLinkonceAlias = weak alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncWeakODRAlias = weak_odr alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncLinkonceODRAlias = weak_odr alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakODRfuncAlias = alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncWeakAlias = weak alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncLinkonceAlias = weak alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncWeakODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncLinkonceODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @linkonceODRfuncAlias = alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncWeakAlias = weak alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncWeakODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
 
 ; PROMOTE-DAG: define hidden void @globalfunc()
 ; PROMOTE-DAG: define internal void @internalfunc()

diff  --git a/llvm/test/ThinLTO/X86/alias_internal.ll b/llvm/test/ThinLTO/X86/alias_internal.ll
index 18ee176b88c4e..66bfa17f9a9fd 100644
--- a/llvm/test/ThinLTO/X86/alias_internal.ll
+++ b/llvm/test/ThinLTO/X86/alias_internal.ll
@@ -14,8 +14,8 @@
 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"
 
-define internal i32 @f(i8*) unnamed_addr {
+define internal i32 @f(ptr) unnamed_addr {
     ret i32 42
 }
 
- at a1 = weak alias i32 (i8*), i32 (i8*)* @f
+ at a1 = weak alias i32 (ptr), ptr @f

diff  --git a/llvm/test/ThinLTO/X86/asm.ll b/llvm/test/ThinLTO/X86/asm.ll
index 0d4066e8f889c..33d3906be0c9d 100644
--- a/llvm/test/ThinLTO/X86/asm.ll
+++ b/llvm/test/ThinLTO/X86/asm.ll
@@ -15,10 +15,10 @@
 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"
 
-define i8* @ref() {
+define ptr @ref() {
 entry:
-  %0 = tail call i8* asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
-  ret i8* %0
+  %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
+  ret ptr %0
 }
 
 ;--- b.s
@@ -31,4 +31,4 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
 @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
 
- at llvm.compiler.used = appending global [1 x i8*] [i8* bitcast ([1 x i8]* @ff_h264_cabac_tables to i8*)], section "llvm.metadata"
+ at llvm.compiler.used = appending global [1 x ptr] [ptr @ff_h264_cabac_tables], section "llvm.metadata"

diff  --git a/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll b/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
index b52cceeb52cd2..cc87c2c6b62bb 100644
--- a/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
+++ b/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll
@@ -25,25 +25,21 @@
 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"
 
- at f1 = alias i1(i8*), i1 (i8*)* @f1_actual
+ at f1 = alias i1(ptr), ptr @f1_actual
 
-define i1 @f1_actual(i8* %p) {
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
+define i1 @f1_actual(ptr %p) {
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1")
   ret i1 %x
 }
 
-define i1 @f2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i1 @f2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  %result = call i1 %fptr_casted(i8* %obj)
+  %fptr = load ptr, ptr %vtable
+  %result = call i1 %fptr(ptr %obj)
   ret i1 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)

diff  --git a/llvm/test/ThinLTO/X86/cfi-distributed.ll b/llvm/test/ThinLTO/X86/cfi-distributed.ll
index 5959cc72988dd..66b8cc6cc5c4f 100644
--- a/llvm/test/ThinLTO/X86/cfi-distributed.ll
+++ b/llvm/test/ThinLTO/X86/cfi-distributed.ll
@@ -44,18 +44,17 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-grtev4-linux-gnu"
 
 %struct.B = type { %struct.A }
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 
- at _ZTV1B = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+ at _ZTV1B = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
 
-define void @test(i8* %b) {
+define void @test(ptr %b) {
 entry:
-  tail call void @test2(i8* %b)
-  tail call void @test3(i8* %b)
-  %0 = bitcast i8* %b to i8**
-  %vtable2 = load i8*, i8** %0
-  %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A")
-  br i1 %1, label %cont, label %trap
+  tail call void @test2(ptr %b)
+  tail call void @test3(ptr %b)
+  %vtable2 = load ptr, ptr %b
+  %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A")
+  br i1 %0, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
@@ -65,9 +64,9 @@ cont:
   ret void
 }
 
-declare void @test2(i8*)
-declare void @test3(i8*)
-declare i1 @llvm.type.test(i8*, metadata)
+declare void @test2(ptr)
+declare void @test3(ptr)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.trap()
 
 !0 = !{i64 16, !"_ZTS1A"}

diff  --git a/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll b/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
index 1721778d780c8..41fb17d574985 100644
--- a/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
+++ b/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
@@ -17,23 +17,23 @@
 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"
 
-declare !type !0 i8 @baz(i8*)
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare !type !0 i8 @baz(ptr)
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
 
-define i8 @foo(i8* %p) !type !0 {
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @foo(ptr %p) !type !0 {
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
   %1 = select i1 %x, i8 0, i8 1
   ret i8 %1
 }
 
-define i8 @bar(i8* %p) !type !0 {
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @bar(ptr %p) !type !0 {
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
   ret i8 2
 }
 
-define i8 @f(i1 %i, i8* %p) {
-  %1 = select i1 %i, i8(i8*)* @foo, i8(i8*)* @baz
-  %2 = call i8 %1(i8* %p)
+define i8 @f(i1 %i, ptr %p) {
+  %1 = select i1 %i, ptr @foo, ptr @baz
+  %2 = call i8 %1(ptr %p)
   ret i8 %2
 }
 

diff  --git a/llvm/test/ThinLTO/X86/cfi-icall.ll b/llvm/test/ThinLTO/X86/cfi-icall.ll
index 96179e2562435..76847e8300434 100644
--- a/llvm/test/ThinLTO/X86/cfi-icall.ll
+++ b/llvm/test/ThinLTO/X86/cfi-icall.ll
@@ -8,21 +8,21 @@
 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"
 
-define i1 @foo(i8* %p) !type !0 {
+define i1 @foo(ptr %p) !type !0 {
 entry:
-  %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
+  %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1")
   ret i1 %x
 }
 
-declare !type !0 i1 @bar(i8*)
+declare !type !0 i1 @bar(ptr)
 
 ; Functions must be address taken to have jump table entries emitted
 define void @addrtaken(i1 %i) {
-  %1 = select i1 %i, i1(i8*)* @foo, i1(i8*)* @bar
+  %1 = select i1 %i, ptr @foo, ptr @bar
   ret void
 }
 
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
 
 !0 = !{i64 0, !"typeid1"}
 

diff  --git a/llvm/test/ThinLTO/X86/cfi-unsat.ll b/llvm/test/ThinLTO/X86/cfi-unsat.ll
index e60ebdc9e4313..10c1dd56565d8 100644
--- a/llvm/test/ThinLTO/X86/cfi-unsat.ll
+++ b/llvm/test/ThinLTO/X86/cfi-unsat.ll
@@ -31,28 +31,26 @@
 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 }
 
 $test2 = comdat any
 
-define linkonce_odr i32 @test2(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @test2(ptr %obj, i32 %a) comdat {
 entry:
-  %0 = bitcast %struct.A* %obj to i8**
-  %vtable5 = load i8*, i8** %0
+  %vtable5 = load ptr, ptr %obj
 
-  %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 8, metadata !"_ZTS1A")
-  %2 = extractvalue { i8*, i1 } %1, 1
-  br i1 %2, label %cont, label %trap
+  %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 8, metadata !"_ZTS1A")
+  %1 = extractvalue { ptr, i1 } %0, 1
+  br i1 %1, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
   unreachable
 
 cont:
-  %3 = extractvalue { i8*, i1 } %1, 0
-  %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+  %2 = extractvalue { ptr, i1 } %0, 0
 
-  %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
@@ -76,5 +74,5 @@ cont:
 ; CHECK-IR1-NEXT:     unreachable
 ; CHECK-IR1-NEXT:   }
 
-declare { i8*, i1 } @llvm.type.checked.load(i8*, i32, metadata)
+declare { ptr, i1 } @llvm.type.checked.load(ptr, i32, metadata)
 declare void @llvm.trap()

diff  --git a/llvm/test/ThinLTO/X86/cfi.ll b/llvm/test/ThinLTO/X86/cfi.ll
index 3153406f4d8ea..1384b1ccbecc8 100644
--- a/llvm/test/ThinLTO/X86/cfi.ll
+++ b/llvm/test/ThinLTO/X86/cfi.ll
@@ -16,20 +16,19 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-grtev4-linux-gnu"
 
 %struct.B = type { %struct.A }
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 
- at _ZTV1B = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+ at _ZTV1B = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
 
 ; CHECK-IR-LABEL: define void @test
-define void @test(i8* %b) {
+define void @test(ptr %b) {
 entry:
   ; Ensure that traps are conditional. Invalid TYPE_ID can cause
   ; unconditional traps.
   ; CHECK-IR: br i1 {{.*}}, label %trap
-  %0 = bitcast i8* %b to i8**
-  %vtable2 = load i8*, i8** %0
-  %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A")
-  br i1 %1, label %cont, label %trap
+  %vtable2 = load ptr, ptr %b
+  %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A")
+  br i1 %0, label %cont, label %trap
 
 trap:
   tail call void @llvm.trap()
@@ -41,10 +40,10 @@ cont:
 }
 ; CHECK-IR-LABEL: }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.trap()
 
-declare i32 @_ZN1B1fEi(%struct.B* %this, i32 %a)
+declare i32 @_ZN1B1fEi(ptr %this, i32 %a)
 
 !0 = !{i64 16, !"_ZTS1A"}
 !1 = !{i64 16, !"_ZTS1B"}

diff  --git a/llvm/test/ThinLTO/X86/ctor-dtor-alias.ll b/llvm/test/ThinLTO/X86/ctor-dtor-alias.ll
index 736555a2acc78..f87fc16c933e1 100644
--- a/llvm/test/ThinLTO/X86/ctor-dtor-alias.ll
+++ b/llvm/test/ThinLTO/X86/ctor-dtor-alias.ll
@@ -3,7 +3,7 @@
 ;; template <typename T>
 ;; struct A { A() {} virtual ~A() {} };
 ;; template struct A<void>;
-;; void *foo() { return new A<void>; }
+;; ptr foo() { return new A<void>; }
 ;;
 ;; clang -c -fpic -O1 -flto=thin a.cc && cp a.o b.o && ld.lld -shared a.o b.so
 

diff  --git a/llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll b/llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll
index c52e50904d966..7e79c26e3fb7c 100644
--- a/llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll
+++ b/llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll
@@ -8,7 +8,7 @@
 ;; template <typename T>
 ;; struct A final { virtual ~A() {} };
 ;; template struct A<int>;
-;; extern "C" void bb(A<int> *a) { delete a; }
+;; extern "C" void bb(Aptr a) { delete a; }
 ;;
 ;; clang -c -fpic -O0 -flto=thin a.cc && ld.lld -shared a.o b.o
 ;;

diff  --git a/llvm/test/ThinLTO/X86/devirt-after-icp.ll b/llvm/test/ThinLTO/X86/devirt-after-icp.ll
index 0b306f90feaeb..96a998d3561ac 100644
--- a/llvm/test/ThinLTO/X86/devirt-after-icp.ll
+++ b/llvm/test/ThinLTO/X86/devirt-after-icp.ll
@@ -70,38 +70,33 @@
 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"
 
-%class.A = type { i32 (...)** }
+%class.A = type { ptr }
 %class.B = type { %class.A }
 
- at _ZTV1A = linkonce_odr hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%class.A*)* @_ZN1A3fooEv to i8*), i8* bitcast (i32 (%class.A*)* @_ZN1A3barEv to i8*)] }, align 8, !type !0
- at _ZTV1B = hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%class.B*)* @_ZN1B3fooEv to i8*), i8* bitcast (i32 (%class.B*)* @_ZN1B3barEv to i8*)] }, align 8, !type !0, !type !1
+ at _ZTV1A = linkonce_odr hidden unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1A3fooEv, ptr @_ZN1A3barEv] }, align 8, !type !0
+ at _ZTV1B = hidden unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B3fooEv, ptr @_ZN1B3barEv] }, align 8, !type !0, !type !1
 
-define hidden i32 @_Z3bazP1A(%class.A* %a) local_unnamed_addr {
+define hidden i32 @_Z3bazP1A(ptr %a) local_unnamed_addr {
 entry:
-  %0 = bitcast %class.A* %a to i32 (%class.A*)***
-  %vtable = load i32 (%class.A*)**, i32 (%class.A*)*** %0, align 8
-  %1 = bitcast i32 (%class.A*)** %vtable to i8*
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
-  tail call void @llvm.assume(i1 %2)
-  %3 = load i32 (%class.A*)*, i32 (%class.A*)** %vtable, align 8
+  %vtable = load ptr, ptr %a, align 8
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
+  tail call void @llvm.assume(i1 %0)
+  %1 = load ptr, ptr %vtable, align 8
   ; This is the compare instruction inserted by ICP
-  %4 = icmp eq i32 (%class.A*)* %3, bitcast (i32 (%class.B*)* @_ZN1B3fooEv to i32 (%class.A*)*)
-  br i1 %4, label %if.true.direct_targ, label %if.false.orig_indirect
+  %2 = icmp eq ptr %1, @_ZN1B3fooEv
+  br i1 %2, label %if.true.direct_targ, label %if.false.orig_indirect
 
 ; This block contains the promoted and inlined call to B::foo();
 ; CHECK-IR: if.true.direct_targ:                              ; preds = %entry
 if.true.direct_targ:                              ; preds = %entry
-  %5 = bitcast %class.A* %a to %class.B*
-  %6 = bitcast i32 (%class.A*)** %vtable to i8*
-  %7 = tail call i1 @llvm.type.test(i8* %6, metadata !"_ZTS1B")
-  tail call void @llvm.assume(i1 %7)
-  %vfn.i1 = getelementptr inbounds i32 (%class.A*)*, i32 (%class.A*)** %vtable, i64 1
-  %vfn.i = bitcast i32 (%class.A*)** %vfn.i1 to i32 (%class.B*)**
-  %8 = load i32 (%class.B*)*, i32 (%class.B*)** %vfn.i, align 8
+  %3 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1B")
+  tail call void @llvm.assume(i1 %3)
+  %vfn.i1 = getelementptr inbounds ptr, ptr %vtable, i64 1
+  %4 = load ptr, ptr %vfn.i1, align 8
 ; Call to bar() can be devirtualized to call to B::bar(), since it was
 ; inlined from B::foo() after ICP introduced the guarded promotion.
 ; CHECK-IR: %call.i = tail call i32 @_ZN1B3barEv(ptr nonnull %a)
-  %call.i = tail call i32 %8(%class.B* %5)
+  %call.i = tail call i32 %4(ptr %a)
   br label %if.end.icp
 
 ; This block contains the fallback indirect call a->foo()
@@ -109,22 +104,22 @@ if.true.direct_targ:                              ; preds = %entry
 if.false.orig_indirect:                           ; preds = %entry
 ; Fallback indirect call to foo() cannot be devirtualized.
 ; CHECK-IR: %call = tail call i32 %
-  %call = tail call i32 %3(%class.A* nonnull %a)
+  %call = tail call i32 %1(ptr nonnull %a)
   br label %if.end.icp
 
 if.end.icp:                                       ; preds = %if.false.orig_indirect, %if.true.direct_targ
-  %9 = phi i32 [ %call, %if.false.orig_indirect ], [ %call.i, %if.true.direct_targ ]
-  ret i32 %9
+  %5 = phi i32 [ %call, %if.false.orig_indirect ], [ %call.i, %if.true.direct_targ ]
+  ret i32 %5
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 declare void @llvm.assume(i1)
 
-declare dso_local i32 @_ZN1B3fooEv(%class.B* %this) unnamed_addr
-declare dso_local i32 @_ZN1B3barEv(%class.B*) unnamed_addr
-declare dso_local i32 @_ZN1A3barEv(%class.A* %this) unnamed_addr
-declare dso_local i32 @_ZN1A3fooEv(%class.A* %this) unnamed_addr
+declare dso_local i32 @_ZN1B3fooEv(ptr %this) unnamed_addr
+declare dso_local i32 @_ZN1B3barEv(ptr) unnamed_addr
+declare dso_local i32 @_ZN1A3barEv(ptr %this) unnamed_addr
+declare dso_local i32 @_ZN1A3fooEv(ptr %this) unnamed_addr
 
 !0 = !{i64 16, !"_ZTS1A"}
 !1 = !{i64 16, !"_ZTS1B"}

diff  --git a/llvm/test/ThinLTO/X86/devirt.ll b/llvm/test/ThinLTO/X86/devirt.ll
index 18bd34840bbfd..3bb5d6b2e4e0d 100644
--- a/llvm/test/ThinLTO/X86/devirt.ll
+++ b/llvm/test/ThinLTO/X86/devirt.ll
@@ -90,75 +90,68 @@
 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 }
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _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
- at _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
- at _ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
+ at _ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2
+ at _ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
 
 
 ; CHECK-IR-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
   ; Ensure !prof and !callees metadata for indirect call promotion removed.
   ; CHECK-IR-NOT: prof
   ; CHECK-IR-NOT: callees
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a), !prof !5, !callees !6
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a), !prof !5, !callees !6
 
-  %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
-  %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+  %fptr22 = load ptr, ptr %vtable, align 8
 
   ; We still have to call it as virtual.
   ; CHECK-IR: %call3 = tail call i32 %fptr22
-  %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+  %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
 
-  %4 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %4
-  %5 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %5, metadata !4)
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
   call void @llvm.assume(i1 %p2)
 
-  %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR: %call4 = tail call i32 @_ZN1D1mEi
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
   ret i32 %call4
 }
 ; CHECK-IR-LABEL: ret i32
 ; CHECK-IR-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;
 }
 
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
@@ -171,4 +164,4 @@ attributes #0 = { noinline optnone }
 !3 = !{i64 16, !4}
 !4 = distinct !{}
 !5 = !{!"VP", i32 0, i64 1, i64 1621563287929432257, i64 1}
-!6 = !{i32 (%struct.A*, i32)* @_ZN1A1nEi}
+!6 = !{ptr @_ZN1A1nEi}

diff  --git a/llvm/test/ThinLTO/X86/devirt2.ll b/llvm/test/ThinLTO/X86/devirt2.ll
index 43f76a81ba524..1b33741d37bdd 100644
--- a/llvm/test/ThinLTO/X86/devirt2.ll
+++ b/llvm/test/ThinLTO/X86/devirt2.ll
@@ -150,60 +150,53 @@
 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 }
-%struct.D = type { i32 (...)** }
-%struct.E = type { i32 (...)** }
+%struct.D = type { ptr }
+%struct.E = type { ptr }
 
- at _ZTV1B = external constant [4 x i8*]
- at _ZTV1C = external constant [4 x i8*]
-;@_ZTV1D = external constant [3 x i8*]
- at _ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+ at _ZTV1B = external constant [4 x ptr]
+ at _ZTV1C = external constant [4 x ptr]
+;@_ZTV1D = external constant [3 x ptr]
+ at _ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
 
-define linkonce_odr i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 
 ; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, %struct.E* %obj3, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, ptr %obj3, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was devirtualized. Ignore extra character before
   ; symbol name which would happen if it was promoted during module
   ; splitting for hybrid WPD.
   ; CHECK-IR1: %call = tail call i32 @_ZN1A1nEi
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
-  %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
-  %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+  %fptr22 = load ptr, ptr %vtable, align 8
 
   ; We still have to call it as virtual.
   ; CHECK-IR1: %call3 = tail call i32 %fptr22
-  %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+  %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
 
-  %4 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %4
-  %5 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %5, metadata !"_ZTS1D")
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
   call void @llvm.assume(i1 %p2)
 
-  %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
 
-  %call5 = tail call i32 @test2(%struct.E* nonnull %obj3, i32 %call4)
+  %call5 = tail call i32 @test2(ptr nonnull %obj3, i32 %call4)
   ret i32 %call5
 }
 ; CHECK-IR1-LABEL: ret i32
@@ -216,9 +209,9 @@ entry:
 ; splitting for hybrid WPD.
 ; CHECK-IR2-NEXT:   %call4 = tail call i32 @{{.*}}_ZN1E1mEi
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
-declare i32 @test2(%struct.E* %obj, i32 %a)
+declare i32 @test2(ptr %obj, i32 %a)
 
 attributes #0 = { noinline optnone }
 

diff  --git a/llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll b/llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll
index cdc3f574e3e2c..68b83debef7d3 100644
--- a/llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll
+++ b/llvm/test/ThinLTO/X86/devirt_after_filtering_unreachable.ll
@@ -64,21 +64,18 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 %Derived = type { %Base }
-%Base = type { i32 (...)** }
+%Base = type { ptr }
 
- at _ZTV7Derived = external constant { [5 x i8*] }
+ at _ZTV7Derived = external constant { [5 x ptr] }
 
 define hidden i32 @main() {
 entry:
-  %call = tail call i8* @_Znwm(i64 8)
-  %0 = bitcast i8* %call to %Derived*
-  %1 = getelementptr inbounds %Derived, %Derived* %0, i64 0, i32 0, i32 0
-  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [5 x i8*] }, { [5 x i8*] }* @_ZTV7Derived, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %1
-  %2 = getelementptr %Derived, %Derived* %0, i64 0, i32 0
-  tail call void @_Z3fooP4Base(%Base* nonnull %2)
+  %call = tail call ptr @_Znwm(i64 8)
+  store ptr getelementptr inbounds ({ [5 x ptr] }, ptr @_ZTV7Derived, i64 0, inrange i32 0, i64 2), ptr %call
+  tail call void @_Z3fooP4Base(ptr nonnull %call)
   ret i32 0
 }
 
-declare i8* @_Znwm(i64)
+declare ptr @_Znwm(i64)
 
-declare void @_Z3fooP4Base(%Base*)
+declare void @_Z3fooP4Base(ptr)

diff  --git a/llvm/test/ThinLTO/X86/devirt_alias.ll b/llvm/test/ThinLTO/X86/devirt_alias.ll
index 78ebd471b010c..38ce41163c18c 100644
--- a/llvm/test/ThinLTO/X86/devirt_alias.ll
+++ b/llvm/test/ThinLTO/X86/devirt_alias.ll
@@ -26,33 +26,30 @@
 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.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+ at _ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
 
 ; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj2, i32 %a) {
 entry:
-  %0 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1D")
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
   call void @llvm.assume(i1 %p2)
 
-  %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %a)
   ret i32 %call4
 }
 ; CHECK-IR1-LABEL: ret i32
 ; CHECK-IR1-LABEL: }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
 
 attributes #0 = { noinline optnone }
 

diff  --git a/llvm/test/ThinLTO/X86/devirt_available_externally.ll b/llvm/test/ThinLTO/X86/devirt_available_externally.ll
index 94ab7b7575874..e5661709bcb1e 100644
--- a/llvm/test/ThinLTO/X86/devirt_available_externally.ll
+++ b/llvm/test/ThinLTO/X86/devirt_available_externally.ll
@@ -42,32 +42,29 @@
 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.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _ZTV1D = available_externally constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }
+ at _ZTV1D = available_externally constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }
 
 ; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj2, i32 %a) {
 entry:
-  %0 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1D")
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
   call void @llvm.assume(i1 %p2)
 
-  %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %a)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %a)
   ret i32 %call4
 }
 ; CHECK-IR1-LABEL: ret i32
 ; CHECK-IR1-LABEL: }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
 
 attributes #0 = { noinline optnone }

diff  --git a/llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll b/llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
index fbcaba9db9a4f..2417532568043 100644
--- a/llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
+++ b/llvm/test/ThinLTO/X86/devirt_external_comdat_same_guid.ll
@@ -33,44 +33,40 @@ target triple = "x86_64-grtev4-linux-gnu"
 
 source_filename = "-"
 
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 %struct.B = type { %struct.A }
 
 $_ZTV1B = comdat any
 
- at _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.B*, i32)* @_ZN1B1nEi to i8*)] }, comdat, !type !0, !type !1
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, comdat, !type !0, !type !1
 
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
    ret i32 0;
 }
 
-define i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1nEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
    ret i32 0;
 }
 
 ; Ensures that vtable of B is live so that we will attempt devirt.
-define dso_local i32 @use_B(%struct.B* %a) {
+define dso_local i32 @use_B(ptr %a) {
 entry:
-  %0 = bitcast %struct.B* %a to i32 (...)***
-  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV1B, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+  store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV1B, i64 0, inrange i32 0, i64 2), ptr %a, align 8
   ret i32 0
 }
 
 ; CHECK-IR1: define i32 @test(
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR1: tail call i32 {{.*}}@_ZN1A1nEi
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
@@ -79,7 +75,7 @@ entry:
 ; Check that the call was devirtualized.
 ; CHECK-IR2:   tail call i32 @_ZN1A1nEi
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 attributes #0 = { noinline optnone }

diff  --git a/llvm/test/ThinLTO/X86/devirt_local_same_guid.ll b/llvm/test/ThinLTO/X86/devirt_local_same_guid.ll
index 4dd8a8d120657..3efea8de3fbc6 100644
--- a/llvm/test/ThinLTO/X86/devirt_local_same_guid.ll
+++ b/llvm/test/ThinLTO/X86/devirt_local_same_guid.ll
@@ -21,42 +21,38 @@ target triple = "x86_64-grtev4-linux-gnu"
 
 source_filename = "-"
 
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
 %struct.B = type { %struct.A }
 
- at _ZTV1B = internal constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1nEi to i8*)] }, !type !0, !type !1
+ at _ZTV1B = internal constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, !type !0, !type !1
 
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
-define internal i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1nEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 
 ; Ensures that vtable of B is live so that we will attempt devirt.
-define dso_local i32 @use_B(%struct.B* %a) {
+define dso_local i32 @use_B(ptr %a) {
 entry:
-  %0 = bitcast %struct.B* %a to i32 (...)***
-  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV1B, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+  store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV1B, i64 0, inrange i32 0, i64 2), ptr %a, align 8
   ret i32 0
 }
 
 ; CHECK-IR1: define i32 @test(
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was not devirtualized.
   ; CHECK-IR1: %call = tail call i32 %fptr1
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
@@ -65,7 +61,7 @@ entry:
 ; Check that the call was not devirtualized.
 ; CHECK-IR2:   %call4 = tail call i32 %fptr
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 attributes #0 = { noinline optnone }

diff  --git a/llvm/test/ThinLTO/X86/devirt_multiple_type_test.ll b/llvm/test/ThinLTO/X86/devirt_multiple_type_test.ll
index d5524b44286ea..30b722b5a8b33 100644
--- a/llvm/test/ThinLTO/X86/devirt_multiple_type_test.ll
+++ b/llvm/test/ThinLTO/X86/devirt_multiple_type_test.ll
@@ -23,41 +23,36 @@ source_filename = "devirt_multiple_type_test.cc"
 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"
 
-%class.A = type { i32 (...)** }
+%class.A = type { ptr }
 %class.B = type { %class.A }
 
- at _ZTV1A = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (void (%class.A*)* @_ZN1A3fooEv to i8*)] }, align 8, !type !0, !vcall_visibility !2
- at _ZTV1B = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (void (%class.B*)* @_ZN1B3fooEv to i8*)] }, align 8, !type !0, !type !3, !vcall_visibility !2
+ at _ZTV1A = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1A3fooEv] }, align 8, !type !0, !vcall_visibility !2
+ at _ZTV1B = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1B3fooEv] }, align 8, !type !0, !type !3, !vcall_visibility !2
 
-declare void @_ZN1A3fooEv(%class.A* nocapture %this)
+declare void @_ZN1A3fooEv(ptr nocapture %this)
 
-define hidden void @_ZN1B3fooEv(%class.B* nocapture %this) {
+define hidden void @_ZN1B3fooEv(ptr nocapture %this) {
 entry:
   ret void
 }
 
 ; Function Attrs: nounwind readnone willreturn
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 ; Function Attrs: nounwind willreturn
 declare void @llvm.assume(i1)
 
 ; Function Attrs: uwtable
-define hidden void @_Z6callerP1B(%class.B* %b) local_unnamed_addr {
+define hidden void @_Z6callerP1B(ptr %b) local_unnamed_addr {
 entry:
-  %0 = bitcast %class.B* %b to void (%class.B*)***
-  %vtable = load void (%class.B*)**, void (%class.B*)*** %0, align 8, !tbaa !12, !invariant.group !15
-  %1 = bitcast void (%class.B*)** %vtable to i8*
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+  %vtable = load ptr, ptr %b, align 8, !tbaa !12, !invariant.group !15
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1B")
+  tail call void @llvm.assume(i1 %0)
+  %1 = load ptr, ptr %vtable, align 8, !invariant.load !15
+  tail call void %1(ptr %b)
+  %2 = tail call i1 @llvm.type.test(ptr nonnull %vtable, metadata !"_ZTS1A")
   tail call void @llvm.assume(i1 %2)
-  %3 = load void (%class.B*)*, void (%class.B*)** %vtable, align 8, !invariant.load !15
-  tail call void %3(%class.B* %b)
-  %4 = getelementptr %class.B, %class.B* %b, i64 0, i32 0
-  %5 = bitcast void (%class.B*)** %vtable to i8*
-  %6 = tail call i1 @llvm.type.test(i8* nonnull %5, metadata !"_ZTS1A")
-  tail call void @llvm.assume(i1 %6)
-  %7 = bitcast void (%class.B*)* %3 to void (%class.A*)*
-  tail call void %7(%class.A* %4)
+  tail call void %1(ptr %b)
   ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/devirt_promote.ll b/llvm/test/ThinLTO/X86/devirt_promote.ll
index 39f0229de9ca6..fc2b41f215af1 100644
--- a/llvm/test/ThinLTO/X86/devirt_promote.ll
+++ b/llvm/test/ThinLTO/X86/devirt_promote.ll
@@ -43,23 +43,20 @@
 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 }
 
 ; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR1: %call = tail call i32 @_ZN1A1nEi
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
@@ -70,7 +67,7 @@ entry:
 ; Check that the call was devirtualized.
 ; CHECK-IR2:   %call4 = tail call i32 @_ZN1A1nEi
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 attributes #0 = { noinline optnone }

diff  --git a/llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll b/llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
index ab3d6a1e7be95..cff616091e03d 100644
--- a/llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
+++ b/llvm/test/ThinLTO/X86/devirt_pure_virtual_base.ll
@@ -57,50 +57,47 @@
 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 }
 
- at _ZTV1A = linkonce_odr unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (void ()* @__cxa_pure_virtual to i8*), i8* bitcast (void ()* @__cxa_pure_virtual to i8*)] }, !type !0, !vcall_visibility !2
- at _ZTV1B = linkonce_odr unnamed_addr 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, !vcall_visibility !2
+ at _ZTV1A = linkonce_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @__cxa_pure_virtual, ptr @__cxa_pure_virtual] }, !type !0, !vcall_visibility !2
+ at _ZTV1B = linkonce_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1, !vcall_visibility !2
 
 ;; Prevent the vtables from being dead code eliminated.
- at llvm.used = appending global [2 x i8*] [ i8* bitcast ( { [4 x i8*] }* @_ZTV1A to i8*), i8* bitcast ( { [4 x i8*] }* @_ZTV1B to i8*)]
+ at llvm.used = appending global [2 x ptr] [ ptr @_ZTV1A, ptr @_ZTV1B]
 
 ; CHECK-IR-LABEL: define dso_local i32 @_start
-define i32 @_start(%struct.A* %obj, i32 %a) {
+define i32 @_start(ptr %obj, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ;; Check that the call was devirtualized.
   ; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
   ; CHECK-NODEVIRT-IR: %call = tail call i32 %fptr1
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
   ret i32 %call
 }
 ; CHECK-IR-LABEL: ret i32
 ; CHECK-IR-NEXT: }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 declare void @__cxa_pure_virtual() unnamed_addr
 
-define linkonce_odr i32 @_ZN1A1fEi(%struct.A* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1A1fEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 
-define linkonce_odr i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 
-define linkonce_odr i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
    ret i32 0
 }
 

diff  --git a/llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll b/llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
index 611be11ff8a7a..7ebb22c6f98c8 100644
--- a/llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
+++ b/llvm/test/ThinLTO/X86/devirt_vcall_vis_hidden.ll
@@ -61,72 +61,65 @@
 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 }
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _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, !vcall_visibility !5
- at _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, !vcall_visibility !5
- at _ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3, !vcall_visibility !5
+ at _ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1, !vcall_visibility !5
+ at _ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2, !vcall_visibility !5
+ at _ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3, !vcall_visibility !5
 
 
 ; CHECK-IR-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, i32 %a) {
 entry:
-  %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")
   call void @llvm.assume(i1 %p)
-  %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
+  %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+  %fptr1 = load ptr, ptr %fptrptr, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
-  %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+  %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
 
-  %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
-  %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+  %fptr22 = load ptr, ptr %vtable, align 8
 
   ; We still have to call it as virtual.
   ; CHECK-IR: %call3 = tail call i32 %fptr22
-  %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+  %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
 
-  %4 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %4
-  %5 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %5, metadata !4)
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
   call void @llvm.assume(i1 %p2)
 
-  %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was devirtualized.
   ; CHECK-IR: %call4 = tail call i32 @_ZN1D1mEi
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
   ret i32 %call4
 }
 ; CHECK-IR-LABEL: ret i32
 ; CHECK-IR-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;
 }
 
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
    ret i32 0;
 }
 

diff  --git a/llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll b/llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll
index ff1f40d6ddcd6..83a19ca4767cc 100644
--- a/llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll
+++ b/llvm/test/ThinLTO/X86/dicompositetype-unique-alias.ll
@@ -23,26 +23,26 @@
 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-scei-ps4"
 
-%class.C = type <{ i32 (...)**, %class.A, %struct.CFVS, [6 x i8] }>
+%class.C = type <{ ptr, %class.A, %struct.CFVS, [6 x i8] }>
 %class.A = type { %struct.Vec }
 %struct.Vec = type { i8 }
 %struct.CFVS = type { %struct.Vec }
 %struct.S = type { i8 }
 
-define void @_ZN1CD2Ev(%class.C* %this) unnamed_addr align 2 {
+define void @_ZN1CD2Ev(ptr %this) unnamed_addr align 2 {
 entry:
-  %this.addr = alloca %class.C*, align 8
-  %this1 = load %class.C*, %class.C** %this.addr, align 8
-  %m = getelementptr inbounds %class.C, %class.C* %this1, i32 0, i32 2
-  call void @_ZN4CFVSD1Ev(%struct.CFVS* %m), !dbg !50
-  call void @_ZN4CFVSD2Ev(%struct.CFVS* %m), !dbg !50
+  %this.addr = alloca ptr, align 8
+  %this1 = load ptr, ptr %this.addr, align 8
+  %m = getelementptr inbounds %class.C, ptr %this1, i32 0, i32 2
+  call void @_ZN4CFVSD1Ev(ptr %m), !dbg !50
+  call void @_ZN4CFVSD2Ev(ptr %m), !dbg !50
   ret void
 }
 
-declare void @_ZN4CFVSD1Ev(%struct.CFVS*) unnamed_addr
-declare void @_ZN4CFVSD2Ev(%struct.CFVS*) unnamed_addr
+declare void @_ZN4CFVSD1Ev(ptr) unnamed_addr
+declare void @_ZN4CFVSD2Ev(ptr) unnamed_addr
 
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5, !6}

diff  --git a/llvm/test/ThinLTO/X86/dicompositetype-unique2.ll b/llvm/test/ThinLTO/X86/dicompositetype-unique2.ll
index e7ecc97e31f1b..5c8ad4f4333e6 100644
--- a/llvm/test/ThinLTO/X86/dicompositetype-unique2.ll
+++ b/llvm/test/ThinLTO/X86/dicompositetype-unique2.ll
@@ -16,24 +16,24 @@
 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-scei-ps4"
 
-%class.C = type <{ i32 (...)**, %class.A, %struct.CFVS, [6 x i8] }>
+%class.C = type <{ ptr, %class.A, %struct.CFVS, [6 x i8] }>
 %class.A = type { %struct.Vec }
 %struct.Vec = type { i8 }
 %struct.CFVS = type { %struct.Vec }
 %struct.S = type { i8 }
 
-define void @_ZN1CD2Ev(%class.C* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN1CD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
 entry:
-  %this.addr = alloca %class.C*, align 8
-  %this1 = load %class.C*, %class.C** %this.addr, align 8
-  %m = getelementptr inbounds %class.C, %class.C* %this1, i32 0, i32 2
-  call void @_ZN4CFVSD2Ev(%struct.CFVS* %m), !dbg !50
+  %this.addr = alloca ptr, align 8
+  %this1 = load ptr, ptr %this.addr, align 8
+  %m = getelementptr inbounds %class.C, ptr %this1, i32 0, i32 2
+  call void @_ZN4CFVSD2Ev(ptr %m), !dbg !50
   ret void
 }
 
-declare void @_ZN4CFVSD2Ev(%struct.CFVS*) unnamed_addr
+declare void @_ZN4CFVSD2Ev(ptr) unnamed_addr
 
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
 
 !llvm.dbg.cu = !{!0}
 !llvm.module.flags = !{!3, !4, !5, !6}
@@ -52,7 +52,7 @@ declare dereferenceable(1) %struct.S* @_Z3Getv()
 !16 = !DIFile(filename: "./bz188598.h", directory: ".")
 !17 = !{!55}
 !22 = !{!23}
-!23 = !DITemplateValueParameter(name: "F", type: !24, value: %struct.S* ()* @_Z3Getv)
+!23 = !DITemplateValueParameter(name: "F", type: !24, value: ptr @_Z3Getv)
 !24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64)
 !25 = !DIDerivedType(tag: DW_TAG_typedef, name: "Func", file: !16, line: 2, baseType: !26)
 !26 = !DISubroutineType(types: !27)

diff  --git a/llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll b/llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll
index d8acfaaf03b42..a924327482e14 100644
--- a/llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll
+++ b/llvm/test/ThinLTO/X86/dot-dumper-full-lto.ll
@@ -20,7 +20,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @A = external global i32
 
 define i32 @main() {
-  %v = load i32, i32* @A
+  %v = load i32, ptr @A
   ret i32 %v
 }
 

diff  --git a/llvm/test/ThinLTO/X86/dot-dumper.ll b/llvm/test/ThinLTO/X86/dot-dumper.ll
index 2ab57817be93c..53122160b1b25 100644
--- a/llvm/test/ThinLTO/X86/dot-dumper.ll
+++ b/llvm/test/ThinLTO/X86/dot-dumper.ll
@@ -71,9 +71,9 @@ target triple = "x86_64-unknown-linux-gnu"
 ; Function Attrs: nounwind uwtable
 define i32 @main() local_unnamed_addr {
   %1 = tail call i32 (...) @foo()
-  %2 = load i32, i32* @A, align 4
+  %2 = load i32, ptr @A, align 4
   %3 = add nsw i32 %2, %1
   ret i32 %3
 }
- at main_alias = weak_odr alias i32 (), i32 ()* @main
+ at main_alias = weak_odr alias i32 (), ptr @main
 declare i32 @foo(...) local_unnamed_addr

diff  --git a/llvm/test/ThinLTO/X86/export.ll b/llvm/test/ThinLTO/X86/export.ll
index b0db1e7468fa8..2de3b7fb6ea12 100644
--- a/llvm/test/ThinLTO/X86/export.ll
+++ b/llvm/test/ThinLTO/X86/export.ll
@@ -21,6 +21,6 @@ entry:
 
 define internal void @staticfunc() #0 {
 entry:
-  %0 = load i32, i32* @staticvar, align 4
+  %0 = load i32, ptr @staticvar, align 4
   ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll b/llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
index 8198d8cc11048..6489e952251d0 100644
--- a/llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
+++ b/llvm/test/ThinLTO/X86/funcattrs-prop-maythrow.ll
@@ -63,7 +63,7 @@ define void @nonThrowing() #0 {
 
 declare i32 @__gxx_personality_v0(...)
 
-define void @cleanupret() personality i32 (...)* @__gxx_personality_v0 {
+define void @cleanupret() personality ptr @__gxx_personality_v0 {
 entry:
   invoke void @nonThrowing()
           to label %exit unwind label %pad
@@ -74,7 +74,7 @@ exit:
   ret void
 }
 
-define void @catchret() personality i32 (...)* @__gxx_personality_v0 {
+define void @catchret() personality ptr @__gxx_personality_v0 {
 entry:
   invoke void @nonThrowing()
           to label %exit unwind label %pad
@@ -87,7 +87,7 @@ exit:
   ret void
 }
 
-define void @resume() uwtable optsize ssp personality i32 (...)* @__gxx_personality_v0 {
+define void @resume() uwtable optsize ssp personality ptr @__gxx_personality_v0 {
 entry:
   invoke void @nonThrowing()
           to label %try.cont unwind label %lpad
@@ -96,12 +96,12 @@ try.cont:                                         ; preds = %entry, %invoke.cont
   ret void
 
 lpad:                                             ; preds = %entry
-  %exn = landingpad {i8*, i32}
+  %exn = landingpad {ptr, i32}
            cleanup
-  resume { i8*, i32 } %exn
+  resume { ptr, i32 } %exn
 }
 
-define void @cleanupret_nounwind() #0 personality i32 (...)* @__gxx_personality_v0 {
+define void @cleanupret_nounwind() #0 personality ptr @__gxx_personality_v0 {
 entry:
   invoke void @nonThrowing()
           to label %exit unwind label %pad

diff  --git a/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll b/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll
index c509b669ccbe8..f6f2dc8b1e82b 100644
--- a/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll
+++ b/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll
@@ -9,24 +9,24 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; CHECK-NOT: ; Function Attrs:
 ; CHECK: define i32 @indirect(ptr nocapture %0) {
-define i32 @indirect(i32 ()* nocapture) {
+define i32 @indirect(ptr nocapture) {
   %2 = tail call i32 %0()
   ret i32 %2
 }
 
 ; CHECK-NOT: ; Function Attrs:
 ; CHECK: define ptr @inlineasm() {
-define i8* @inlineasm() {
+define ptr @inlineasm() {
 entry:
-  %0 = tail call i8* asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
-  ret i8* %0
+  %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
+  ret ptr %0
 }
 
 ; CHECK-NOT: ; Function Attrs:
 ; CHECK: define void @selectcallee() {
 define void @selectcallee() {
     ; Test calls that aren't handled either as direct or indirect.
-    call void select (i1 icmp eq (i32* @global, i32* null), void ()* @f, void ()* @g)()
+    call void select (i1 icmp eq (ptr @global, ptr null), ptr @f, ptr @g)()
     ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/funcimport-tbaa.ll b/llvm/test/ThinLTO/X86/funcimport-tbaa.ll
index 5334fbecb31ea..280dddb1cf84d 100644
--- a/llvm/test/ThinLTO/X86/funcimport-tbaa.ll
+++ b/llvm/test/ThinLTO/X86/funcimport-tbaa.ll
@@ -13,19 +13,19 @@
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.11.0"
 
-define float @globalfunc1(i32*, float*) {
-  %3 = load i32, i32* %0, align 4, !tbaa !0
+define float @globalfunc1(ptr, ptr) {
+  %3 = load i32, ptr %0, align 4, !tbaa !0
   %4 = sitofp i32 %3 to float
-  %5 = load float, float* %1, align 4, !tbaa !4
+  %5 = load float, ptr %1, align 4, !tbaa !4
   %6 = fadd float %4, %5
   ret float %6
 }
 
 ; We need a second function for force the metadata to be emitted in the global block
-define float @globalfunc2(i32*, float*) {
-  %3 = load i32, i32* %0, align 4, !tbaa !0
+define float @globalfunc2(ptr, ptr) {
+  %3 = load i32, ptr %0, align 4, !tbaa !0
   %4 = sitofp i32 %3 to float
-  %5 = load float, float* %1, align 4, !tbaa !4
+  %5 = load float, ptr %1, align 4, !tbaa !4
   %6 = fadd float %4, %5
   ret float %6
 }

diff  --git a/llvm/test/ThinLTO/X86/globals-import-blockaddr.ll b/llvm/test/ThinLTO/X86/globals-import-blockaddr.ll
index e7a3ffbffb7c1..dd8c5db826aa1 100644
--- a/llvm/test/ThinLTO/X86/globals-import-blockaddr.ll
+++ b/llvm/test/ThinLTO/X86/globals-import-blockaddr.ll
@@ -13,14 +13,14 @@
 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"
 
-declare dso_local [1 x i8*]* @foo();
-declare dso_local [1 x i8*]* @bar();
+declare dso_local ptr @foo();
+declare dso_local ptr @bar();
 
 define dso_local i32 @main() {
-  %p1 = call [1 x i8*]* @foo()
-  %p2 = call [1 x i8*]* @bar()
-  %v1 = ptrtoint [1 x i8*]* %p1 to i32
-  %v2 = ptrtoint [1 x i8*]* %p2 to i32
+  %p1 = call ptr @foo()
+  %p2 = call ptr @bar()
+  %v1 = ptrtoint ptr %p1 to i32
+  %v2 = ptrtoint ptr %p2 to i32
   %v3 = add i32 %v1, %v2
   ret i32 %v3
 }

diff  --git a/llvm/test/ThinLTO/X86/guid_collision.ll b/llvm/test/ThinLTO/X86/guid_collision.ll
index f56857012214e..efda0bda1599f 100644
--- a/llvm/test/ThinLTO/X86/guid_collision.ll
+++ b/llvm/test/ThinLTO/X86/guid_collision.ll
@@ -27,7 +27,7 @@ source_filename = "-"
 ; from, to test handling of a global variable with an entry in the distributed
 ; index but not with a copy in the source module (since we can't import
 ; appending linkage globals).
- at llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
+ at llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer
 
 define i64 @H() {
   call i64 @G()

diff  --git a/llvm/test/ThinLTO/X86/import-constant.ll b/llvm/test/ThinLTO/X86/import-constant.ll
index dd45c51e85d09..ae77192c9a528 100644
--- a/llvm/test/ThinLTO/X86/import-constant.ll
+++ b/llvm/test/ThinLTO/X86/import-constant.ll
@@ -45,17 +45,16 @@
 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.S = type { i32, i32, i32* }
+%struct.S = type { i32, i32, ptr }
 
 define dso_local i32 @main() local_unnamed_addr {
 entry:
-  %call = tail call %struct.S* @_Z6getObjv()
-  %d = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 0
-  %0 = load i32, i32* %d, align 8
-  %v = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 1
-  %1 = load i32, i32* %v, align 4
+  %call = tail call ptr @_Z6getObjv()
+  %0 = load i32, ptr %call, align 8
+  %v = getelementptr inbounds %struct.S, ptr %call, i64 0, i32 1
+  %1 = load i32, ptr %v, align 4
   %add = add nsw i32 %1, %0
   ret i32 %add
 }
 
-declare dso_local %struct.S* @_Z6getObjv() local_unnamed_addr
+declare dso_local ptr @_Z6getObjv() local_unnamed_addr

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-O0.ll b/llvm/test/ThinLTO/X86/index-const-prop-O0.ll
index c1e945010fbc6..db04bc364cd34 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-O0.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-O0.ll
@@ -13,6 +13,6 @@ target triple = "x86_64-unknown-linux-gnu"
 @g = external global i32
 
 define i32 @main() {
-  %v = load i32, i32* @g
+  %v = load i32, ptr @g
   ret i32 %v
 }

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-alias.ll b/llvm/test/ThinLTO/X86/index-const-prop-alias.ll
index 4a1e68f46f052..1e4855aa840cd 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-alias.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-alias.ll
@@ -33,10 +33,10 @@ target triple = "x86_64-unknown-linux-gnu"
 @g = external global i32
 
 define i32 @main() {
-  %v = load i32, i32* @g
+  %v = load i32, ptr @g
   ret i32 %v
 }
 
-define i32* @ret_ptr() {
-  ret i32* @g.alias
+define ptr @ret_ptr() {
+  ret ptr @g.alias
 }

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-dead.ll b/llvm/test/ThinLTO/X86/index-const-prop-dead.ll
index 6766a5ee71044..a8622b5214914 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-dead.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-dead.ll
@@ -21,6 +21,6 @@ define i32 @main() {
 }
 
 define i32 @foo() {
-  %v = load i32, i32* @g
+  %v = load i32, ptr @g
   ret i32 %v
 }

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-gvref-pie.ll b/llvm/test/ThinLTO/X86/index-const-prop-gvref-pie.ll
index 85eacf4d8baed..c9ccdc7f6feaa 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-gvref-pie.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-gvref-pie.ll
@@ -13,12 +13,12 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-unknown-linux-gnu"
 
 @a = external global i32
- at b = external global i32*
+ at b = external global ptr
 
 define i32 @main() {
-  %p = load i32*, i32** @b, align 8
-  store i32 33, i32* %p, align 4
-  %v = load i32, i32* @a, align 4
+  %p = load ptr, ptr @b, align 8
+  store i32 33, ptr %p, align 4
+  %v = load i32, ptr @a, align 4
   ret i32 %v
 }
 

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll b/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll
index 069285f8eb377..45bf345ea3a1c 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll
@@ -30,22 +30,22 @@
 ; RUN: llvm-dis < %t6.0.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_SRC
 ; RUN: llvm-dis < %t6.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST_DSO
 
-; OLDAPI_SRC:      @b = internal global i32* @a, align 8
+; OLDAPI_SRC:      @b = internal global ptr @a, align 8
 ; OLDAPI_SRC-NEXT: @a = dso_local global i32 42, align 4
-; OLDAPI_DST:      @b = external dso_local global i32*
+; OLDAPI_DST:      @b = external dso_local global ptr
 ; OLDAPI_DST-NEXT: @a = available_externally dso_local global i32 42, align 4
-; OLDAPI_DST_DSO:      @b = external global i32*
+; OLDAPI_DST_DSO:      @b = external global ptr
 ; OLDAPI_DST_DSO-NEXT: @a = available_externally global i32 42, align 4
 
 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"
 
 @a = external global i32
- at b = external global i32*
+ at b = external global ptr
 
 define i32 @main() {
-  %p = load i32*, i32** @b, align 8  
-  store i32 33, i32* %p, align 4
-  %v = load i32, i32* @a, align 4
+  %p = load ptr, ptr @b, align 8  
+  store i32 33, ptr %p, align 4
+  %v = load i32, ptr @a, align 4
   ret i32 %v
 }

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll b/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll
index c94224cda7c47..c20cf94050449 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop-linkage.ll
@@ -19,7 +19,7 @@ target triple = "x86_64-unknown-linux-gnu"
 
 declare i32 @foo()
 @g2 = external global i32
- at llvm.used = appending global [1 x i32*] [i32* @g2]
+ at llvm.used = appending global [1 x ptr] [ptr @g2]
 
 define i32 @main() {
   %v = call i32 @foo()

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop.ll b/llvm/test/ThinLTO/X86/index-const-prop.ll
index b8028d65fa589..5087ec6ad5cab 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop.ll
@@ -38,8 +38,8 @@ target triple = "x86_64-pc-linux-gnu"
 @gDead = internal unnamed_addr global i32 1, align 4
 
 define i32 @main() local_unnamed_addr {
-  %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)()
-  %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)()
+  %call = tail call i32 @foo()
+  %call1 = tail call i32 @bar()
   %add = add nsw i32 %call1, %call
   ret i32 %add
 }

diff  --git a/llvm/test/ThinLTO/X86/index-const-prop2.ll b/llvm/test/ThinLTO/X86/index-const-prop2.ll
index 68fe058a8637c..7f02037e4194b 100644
--- a/llvm/test/ThinLTO/X86/index-const-prop2.ll
+++ b/llvm/test/ThinLTO/X86/index-const-prop2.ll
@@ -87,8 +87,8 @@ target triple = "x86_64-pc-linux-gnu"
 @gBar = external global i32
 
 define i32 @main() local_unnamed_addr {
-  %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)()
-  %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)()
+  %call = tail call i32 @foo()
+  %call1 = tail call i32 @bar()
   %add = add nsw i32 %call1, %call
   ret i32 %add
 }

diff  --git a/llvm/test/ThinLTO/X86/internalize.ll b/llvm/test/ThinLTO/X86/internalize.ll
index 5d80a4fe375a2..2af88758b2ff1 100644
--- a/llvm/test/ThinLTO/X86/internalize.ll
+++ b/llvm/test/ThinLTO/X86/internalize.ll
@@ -80,7 +80,7 @@ define weak void @weak_func_prevailing() {
 ; Make @weak_func_nonprevailing an aliasee to ensure it is still marked
 ; live and kept as a definition even when non-prevailing. We want to ensure
 ; this definition is not internalized.
- at alias1 = hidden alias void (), void ()* @weak_func_nonprevailing
+ at alias1 = hidden alias void (), ptr @weak_func_nonprevailing
 define weak void @weak_func_nonprevailing() {
     ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/lazyload_metadata.ll b/llvm/test/ThinLTO/X86/lazyload_metadata.ll
index 351201982d96c..1fea2d0432c69 100644
--- a/llvm/test/ThinLTO/X86/lazyload_metadata.ll
+++ b/llvm/test/ThinLTO/X86/lazyload_metadata.ll
@@ -23,7 +23,7 @@ target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-apple-macosx10.11.0"
 
 define void @globalfunc1(i32 %arg) {
-  %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
+  %x = call i1 @llvm.type.test(ptr undef, metadata !"typeid1")
   %tmp = add i32 %arg, 0, !metadata !2
   ret void
 }
@@ -34,7 +34,7 @@ define void @globalfunc1(i32 %arg) {
 ; These function are not imported and so we don't want to load their metadata.
 
 define void @globalfunc2(i32 %arg) {
-  %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
+  %x = call i1 @llvm.type.test(ptr undef, metadata !"typeid1")
   %tmp = add i32 %arg, 0, !metadata !1
   ret void
 }
@@ -44,7 +44,7 @@ define void @globalfunc3(i32 %arg) {
   ret void
 }
 
-declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
+declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone
 
 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
 !2 = !{!"Hello World"}

diff  --git a/llvm/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll b/llvm/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
index 2cff8b4b27580..231a683430ed3 100644
--- a/llvm/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
+++ b/llvm/test/ThinLTO/X86/linkonce_aliasee_ref_import.ll
@@ -28,7 +28,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-grtev4-linux-gnu"
 
 $baz.clone = comdat any
- at baz = weak alias void (), void ()* @baz.clone
+ at baz = weak alias void (), ptr @baz.clone
 
 define void @foo() #5 align 2 {
   tail call void @baz.clone()

diff  --git a/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll b/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
index 2fb226046ea9f..3768549c558c5 100644
--- a/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
+++ b/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll
@@ -12,12 +12,12 @@
 ; from second module is preempted and converted to available_externally and
 ; removed from comdat.
 ; IMPORT1: @g_private = private global i32 43, comdat($g)
-; IMPORT1: define weak_odr i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] comdat {
+; IMPORT1: define weak_odr i32 @f(ptr %0) unnamed_addr [[ATTR:#[0-9]+]] comdat {
 ; IMPORT1: define weak_odr i32 @g() unnamed_addr [[ATTR]] comdat {
 ; IMPORT1: define internal void @g_internal() unnamed_addr comdat($g) {
 
 ; IMPORT2: @g_private = available_externally dso_local global i32 41{{$}}
-; IMPORT2: define available_externally i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] {
+; IMPORT2: define available_externally i32 @f(ptr %0) unnamed_addr [[ATTR:#[0-9]+]] {
 ; IMPORT2: define available_externally i32 @g() unnamed_addr [[ATTR]] {
 ; IMPORT2: define available_externally dso_local void @g_internal() unnamed_addr {
 
@@ -41,7 +41,7 @@ $g = comdat any
 
 @g_private = private global i32 43, comdat($g)
 
-define linkonce_odr i32 @f(i8*) unnamed_addr comdat {
+define linkonce_odr i32 @f(ptr) unnamed_addr comdat {
     ret i32 43
 }
 

diff  --git a/llvm/test/ThinLTO/X86/llvm.used.ll b/llvm/test/ThinLTO/X86/llvm.used.ll
index 266ab2beb3b23..52e39fac507dc 100644
--- a/llvm/test/ThinLTO/X86/llvm.used.ll
+++ b/llvm/test/ThinLTO/X86/llvm.used.ll
@@ -16,7 +16,7 @@ target triple = "x86_64-apple-macosx10.11.0"
 define internal void @_ZN12_GLOBAL__N_16Module4dumpEv() {
     ret void
 }
- at llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ZN12_GLOBAL__N_16Module4dumpEv to i8*)], section "llvm.metadata"
+ at llvm.used = appending global [1 x ptr] [ptr @_ZN12_GLOBAL__N_16Module4dumpEv], section "llvm.metadata"
 
 
 define void @globalfunc() #0 {

diff  --git a/llvm/test/ThinLTO/X86/load-store-caching.ll b/llvm/test/ThinLTO/X86/load-store-caching.ll
index 41000f583a1c1..4fb2d4693042e 100644
--- a/llvm/test/ThinLTO/X86/load-store-caching.ll
+++ b/llvm/test/ThinLTO/X86/load-store-caching.ll
@@ -8,17 +8,17 @@
 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.S = type { %struct.Derived* }
+%struct.S = type { ptr }
 %struct.Derived = type { i32 }
 %struct.Base = type { i32 }
 
 @obj = dso_local local_unnamed_addr global %struct.S zeroinitializer, align 8
 
-define dso_local %struct.Base* @foo() local_unnamed_addr {
+define dso_local ptr @foo() local_unnamed_addr {
 entry:
-  %0 = load %struct.Base*, %struct.Base** bitcast (%struct.S* @obj to %struct.Base**), align 8
-  store %struct.Base* null, %struct.Base** bitcast (%struct.S* @obj to %struct.Base**), align 8
-  ret %struct.Base* %0
+  %0 = load ptr, ptr @obj, align 8
+  store ptr null, ptr @obj, align 8
+  ret ptr %0
 }
 
 ; CHECK:       ^0 = module:

diff  --git a/llvm/test/ThinLTO/X86/local_name_conflict.ll b/llvm/test/ThinLTO/X86/local_name_conflict.ll
index d5497a4694333..deb376bec39ee 100644
--- a/llvm/test/ThinLTO/X86/local_name_conflict.ll
+++ b/llvm/test/ThinLTO/X86/local_name_conflict.ll
@@ -35,7 +35,7 @@ target triple = "x86_64-unknown-linux-gnu"
 define i32 @main() {
 entry:
   %retval = alloca i32, align 4
-  store i32 0, i32* %retval, align 4
+  store i32 0, ptr %retval, align 4
   %call = call i32 (...) @b()
   ret i32 %call
 }

diff  --git a/llvm/test/ThinLTO/X86/module_asm2.ll b/llvm/test/ThinLTO/X86/module_asm2.ll
index 3f0033849f9cd..7ab7847f79439 100644
--- a/llvm/test/ThinLTO/X86/module_asm2.ll
+++ b/llvm/test/ThinLTO/X86/module_asm2.ll
@@ -70,8 +70,8 @@ target triple = "x86_64-unknown-linux-gnu"
 @b = internal global i32 1, align 4
 @x = internal global i32 1, align 4
 
- at llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @b to i8*)], section "llvm.metadata"
- at llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @x to i8*)], section "llvm.metadata"
+ at llvm.compiler.used = appending global [1 x ptr] [ptr @b], section "llvm.metadata"
+ at llvm.used = appending global [1 x ptr] [ptr @x], section "llvm.metadata"
 
 module asm "\09.text"
 module asm "\09.type\09foo, at function"
@@ -108,12 +108,12 @@ define i32 @func1() #1 {
 }
 
 define i32 @func2() #1 {
-  %1 = load i32, i32* @b, align 4
+  %1 = load i32, ptr @b, align 4
   ret i32 %1
 }
 
 define i32 @func3() #1 {
-  %1 = load i32, i32* @x, align 4
+  %1 = load i32, ptr @x, align 4
   ret i32 %1
 }
 

diff  --git a/llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll b/llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
index d759bcf3151cc..c6e61edcd97a9 100644
--- a/llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
+++ b/llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll
@@ -26,53 +26,49 @@
 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"
 
- at llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @g, i8* null }]
+ at llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @g, ptr null }]
 
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
 
- at _ZTV1D = internal constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+ at _ZTV1D = internal constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
 
 ; CHECK-IR-LABEL: define weak_odr dso_local i32 @test
-define weak_odr i32 @test(%struct.D* %obj2, i32 %a) {
+define weak_odr i32 @test(ptr %obj2, i32 %a) {
 entry:
-  %0 = bitcast %struct.D* %obj2 to i8***
-  %vtable2 = load i8**, i8*** %0
-  %1 = bitcast i8** %vtable2 to i8*
-  %p2 = call i1 @llvm.type.test(i8* %1, metadata !4)
+  %vtable2 = load ptr, ptr %obj2
+  %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
   call void @llvm.assume(i1 %p2)
 
-  %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
-  %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+  %fptr33 = load ptr, ptr %vtable2, align 8
 
   ; Check that the call was not devirtualized.
   ; CHECK-IR: %call4 = tail call i32 %fptr33
-  %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 0)
+  %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 0)
   ret i32 %call4
 }
 ; CHECK-IR-LABEL: ret i32
 ; CHECK-IR-LABEL: }
 
 ; Function Attrs: inlinehint nounwind uwtable
-define internal void @_ZN1DC2Ev(%struct.D* %this) unnamed_addr align 2 {
+define internal void @_ZN1DC2Ev(ptr %this) unnamed_addr align 2 {
 entry:
-  %this.addr = alloca %struct.D*, align 8
-  store %struct.D* %this, %struct.D** %this.addr, align 8
-  %this1 = load %struct.D*, %struct.D** %this.addr
-  %0 = bitcast %struct.D* %this1 to i32 (...)***
-  store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTV1D, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+  %this.addr = alloca ptr, align 8
+  store ptr %this, ptr %this.addr, align 8
+  %this1 = load ptr, ptr %this.addr
+  store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV1D, i64 0, inrange i32 0, i64 2), ptr %this1, align 8
   ret void
 }
 
 define internal void @g() section ".text.startup" {
   %d = alloca %struct.D, align 8
-  call void @_ZN1DC2Ev(%struct.D* %d)
+  call void @_ZN1DC2Ev(ptr %d)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
 
 !3 = !{i64 16, !4}
 !4 = distinct !{}

diff  --git a/llvm/test/ThinLTO/X86/noinline.ll b/llvm/test/ThinLTO/X86/noinline.ll
index 74461853efa7c..cf965c6ff6b68 100644
--- a/llvm/test/ThinLTO/X86/noinline.ll
+++ b/llvm/test/ThinLTO/X86/noinline.ll
@@ -16,7 +16,7 @@ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-pc-linux-gnu"
 
 ; Function Attrs: nounwind ssp uwtable
-define i32 @main(i32, i8** nocapture readnone) local_unnamed_addr #0 {
+define i32 @main(i32, ptr nocapture readnone) local_unnamed_addr #0 {
   %3 = tail call i32 @foo(i32 %0) #0
   ret i32 %3
 }

diff  --git a/llvm/test/ThinLTO/X86/personality.ll b/llvm/test/ThinLTO/X86/personality.ll
index bf773a8ae9b64..c23ee251e4e27 100644
--- a/llvm/test/ThinLTO/X86/personality.ll
+++ b/llvm/test/ThinLTO/X86/personality.ll
@@ -45,28 +45,28 @@
 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-pc-linux-gnu"
 
-declare protected i32 @personality_routine(i32, i32, i64, i8*, i8*)
-declare protected i32 @personality_routine2(i32, i32, i64, i8*, i8*)
-declare protected i32 @personality_routine3(i32, i32, i64, i8*, i8*)
+declare protected i32 @personality_routine(i32, i32, i64, ptr, ptr)
+declare protected i32 @personality_routine2(i32, i32, i64, ptr, ptr)
+declare protected i32 @personality_routine3(i32, i32, i64, ptr, ptr)
 declare void @bar()
 
-define void @foo() personality i32 (i32, i32, i64, i8*, i8*)* @personality_routine {
+define void @foo() personality ptr @personality_routine {
   ret void
 }
 
-define internal void @foo2b() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine2 to i8*) {
+define internal void @foo2b() personality ptr @personality_routine2 {
   ret void
 }
 
-define internal void @foo2a() prologue void ()* @foo2b {
+define internal void @foo2a() prologue ptr @foo2b {
   ret void
 }
 
-define void @foo2() prefix void ()* @foo2a {
+define void @foo2() prefix ptr @foo2a {
   ret void
 }
 
-define void @foo3() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine3 to i8*) {
+define void @foo3() personality ptr @personality_routine3 {
   ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/pr35472.ll b/llvm/test/ThinLTO/X86/pr35472.ll
index 324cb735e5226..f7b19e8ba7969 100644
--- a/llvm/test/ThinLTO/X86/pr35472.ll
+++ b/llvm/test/ThinLTO/X86/pr35472.ll
@@ -26,26 +26,24 @@ $_ZN5DeltaD2Ev = comdat any
 define void @_Z5Bravov() !dbg !7 {
   %Hotel = alloca %struct.Delta, align 4
   %India = alloca %struct.Echo, align 4
-  call void @llvm.dbg.declare(metadata %struct.Delta* %Hotel, metadata !10, metadata !DIExpression()), !dbg !22
-  call void @_ZN4EchoD2Ev(%struct.Echo* %India), !dbg !28
+  call void @llvm.dbg.declare(metadata ptr %Hotel, metadata !10, metadata !DIExpression()), !dbg !22
+  call void @_ZN4EchoD2Ev(ptr %India), !dbg !28
   ret void, !dbg !28
 }
 
 declare void @llvm.dbg.declare(metadata, metadata, metadata)
 
-define linkonce_odr void @_ZN4EchoD2Ev(%struct.Echo* %this) unnamed_addr comdat align 2 {
-  %this.addr.i = alloca %struct.Charlie*, align 8
-  call void @llvm.dbg.declare(metadata %struct.Charlie** %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !32
-  %this1.i = load %struct.Charlie*, %struct.Charlie** %this.addr.i, align 8
-  %Golf.i = getelementptr inbounds %struct.Charlie, %struct.Charlie* %this1.i, i32 0, i32 0, !dbg !33
+define linkonce_odr void @_ZN4EchoD2Ev(ptr %this) unnamed_addr comdat align 2 {
+  %this.addr.i = alloca ptr, align 8
+  call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !32
+  %this1.i = load ptr, ptr %this.addr.i, align 8
   ret void
 }
 
-define linkonce_odr void @_ZN5DeltaD2Ev(%struct.Delta* %this) unnamed_addr comdat align 2 !dbg !36 {
-  %this.addr.i = alloca %struct.Charlie*, align 8
-  call void @llvm.dbg.declare(metadata %struct.Charlie** %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !41
-  %this1.i = load %struct.Charlie*, %struct.Charlie** %this.addr.i, align 8
-  %Golf.i = getelementptr inbounds %struct.Charlie, %struct.Charlie* %this1.i, i32 0, i32 0, !dbg !48
+define linkonce_odr void @_ZN5DeltaD2Ev(ptr %this) unnamed_addr comdat align 2 !dbg !36 {
+  %this.addr.i = alloca ptr, align 8
+  call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !41
+  %this1.i = load ptr, ptr %this.addr.i, align 8
   ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/promote-local-name.ll b/llvm/test/ThinLTO/X86/promote-local-name.ll
index 65c62985c8d62..748ef88ad31c0 100644
--- a/llvm/test/ThinLTO/X86/promote-local-name.ll
+++ b/llvm/test/ThinLTO/X86/promote-local-name.ll
@@ -25,7 +25,7 @@ target triple = "x86_64-unknown-linux-gnu"
 define i32 @main() {
 entry:
   %retval = alloca i32, align 4
-  store i32 0, i32* %retval, align 4
+  store i32 0, ptr %retval, align 4
   %call = call i32 (...) @b()
   ret i32 %call
 }

diff  --git a/llvm/test/ThinLTO/X86/reference_non_importable.ll b/llvm/test/ThinLTO/X86/reference_non_importable.ll
index e36bf370d813a..52856346cb23b 100644
--- a/llvm/test/ThinLTO/X86/reference_non_importable.ll
+++ b/llvm/test/ThinLTO/X86/reference_non_importable.ll
@@ -17,12 +17,12 @@ target triple = "x86_64-apple-macosx10.11.0"
 ; RUN: llvm-dis < %t.o.1.2.internalize.bc | FileCheck  %s --check-prefix=PROMOTE
 ; PROMOTE: @a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
 @a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
- at b = global i8 *@a
+ at b = global ptr at a
 
 
 ; We want foo to be imported in the main module!
 ; RUN: llvm-dis < %t.o.2.3.import.bc  | FileCheck  %s --check-prefix=IMPORT
 ; IMPORT: define available_externally dso_local ptr @foo()
-define i8 **@foo() {
-	ret i8 **@b
+define ptr at foo() {
+	ret ptr at b
 }

diff  --git a/llvm/test/ThinLTO/X86/selective-save-temps.ll b/llvm/test/ThinLTO/X86/selective-save-temps.ll
index d350a82132565..5436ee6ec3af2 100644
--- a/llvm/test/ThinLTO/X86/selective-save-temps.ll
+++ b/llvm/test/ThinLTO/X86/selective-save-temps.ll
@@ -144,17 +144,16 @@
 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.S = type { i32, i32, i32* }
+%struct.S = type { i32, i32, ptr }
 
 define dso_local i32 @main() local_unnamed_addr {
 entry:
-  %call = tail call %struct.S* @_Z6getObjv()
-  %d = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 0
-  %0 = load i32, i32* %d, align 8
-  %v = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 1
-  %1 = load i32, i32* %v, align 4
+  %call = tail call ptr @_Z6getObjv()
+  %0 = load i32, ptr %call, align 8
+  %v = getelementptr inbounds %struct.S, ptr %call, i64 0, i32 1
+  %1 = load i32, ptr %v, align 4
   %add = add nsw i32 %1, %0
   ret i32 %add
 }
 
-declare dso_local %struct.S* @_Z6getObjv() local_unnamed_addr
+declare dso_local ptr @_Z6getObjv() local_unnamed_addr

diff  --git a/llvm/test/ThinLTO/X86/thinlto-internalize-doublepromoted.ll b/llvm/test/ThinLTO/X86/thinlto-internalize-doublepromoted.ll
index fbdedda978597..05c6d9c079165 100644
--- a/llvm/test/ThinLTO/X86/thinlto-internalize-doublepromoted.ll
+++ b/llvm/test/ThinLTO/X86/thinlto-internalize-doublepromoted.ll
@@ -27,7 +27,6 @@ target triple = "x86_64-apple-macosx10.15.0"
 
 ; CHECK: define hidden void @foo.llvm.123()
 define hidden void @foo.llvm.123() {
-  %1 = getelementptr inbounds [10 x i8], [10 x i8]* @switch.table.foo.llvm.123, i64 0, i64 0
-  store i8 1, i8* %1, align 8
+  store i8 1, ptr @switch.table.foo.llvm.123, align 8
   ret void
 }

diff  --git a/llvm/test/ThinLTO/X86/thinlto-internalize-used.ll b/llvm/test/ThinLTO/X86/thinlto-internalize-used.ll
index e0a2eb7b3d3fb..76aa63aa5d9ba 100644
--- a/llvm/test/ThinLTO/X86/thinlto-internalize-used.ll
+++ b/llvm/test/ThinLTO/X86/thinlto-internalize-used.ll
@@ -7,7 +7,7 @@
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.15.0"
 
- at llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @foo to i8*)], section "llvm.metadata"
+ at llvm.used = appending global [1 x ptr] [ptr @foo], section "llvm.metadata"
 
 ; Make sure foo is not internalized.
 ; CHECK: define i32 @foo()

diff  --git a/llvm/test/ThinLTO/X86/tli-nobuiltin.ll b/llvm/test/ThinLTO/X86/tli-nobuiltin.ll
index bf9cf907aec31..2db166bd24485 100644
--- a/llvm/test/ThinLTO/X86/tli-nobuiltin.ll
+++ b/llvm/test/ThinLTO/X86/tli-nobuiltin.ll
@@ -28,7 +28,7 @@
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-apple-macosx10.11.0"
 
-declare i32 @fprintf(%FILE*, i8*, ...)
+declare i32 @fprintf(ptr, ptr, ...)
 
 %FILE = type { }
 
@@ -37,10 +37,8 @@ declare i32 @fprintf(%FILE*, i8*, ...)
 
 ; Check fprintf(fp, "%s", str) -> fwrite(str, fp) only when builtins are enabled
 
-define void @foo(%FILE* %fp) {
-  %fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0
-  %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
-  call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i8* %str)
+define void @foo(ptr %fp) {
+  call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @percent_s, ptr @hello_world)
   ret void
 }
 

diff  --git a/llvm/test/ThinLTO/X86/visibility-elf.ll b/llvm/test/ThinLTO/X86/visibility-elf.ll
index ba395b22bf49b..aa11c3e06ff3b 100644
--- a/llvm/test/ThinLTO/X86/visibility-elf.ll
+++ b/llvm/test/ThinLTO/X86/visibility-elf.ll
@@ -28,7 +28,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @var1 = weak global i32 1, align 4
 @var2 = extern_weak global i32
 
-declare void @ext(void ()*)
+declare void @ext(ptr)
 
 ; CHECK: declare hidden i32 @hidden_def_weak_def()
 ; CHECK: declare protected void @protected_def_weak_def()
@@ -53,7 +53,7 @@ declare void @ext(void ()*)
 
 define weak i32 @hidden_def_weak_def() {
 entry:
-  %0 = load i32, i32* @var2
+  %0 = load i32, ptr @var2
   ret i32 %0
 }
 
@@ -75,13 +75,13 @@ declare hidden void @protected_def_hidden_ref()
 
 define i32 @main() {
 entry:
-  call void @ext(void ()* bitcast (i32 ()* @hidden_def_weak_def to void ()*))
-  call void @ext(void ()* @protected_def_weak_def)
-  call void @ext(void ()* @protected_def_weak_hidden_def)
-  call void @ext(void ()* @hidden_def_ref)
-  call void @ext(void ()* @hidden_def_weak_ref)
-  call void @ext(void ()* @protected_def_hidden_ref)
-  call void @ext(void ()* @not_imported)
+  call void @ext(ptr @hidden_def_weak_def)
+  call void @ext(ptr @protected_def_weak_def)
+  call void @ext(ptr @protected_def_weak_hidden_def)
+  call void @ext(ptr @hidden_def_ref)
+  call void @ext(ptr @hidden_def_weak_ref)
+  call void @ext(ptr @protected_def_hidden_ref)
+  call void @ext(ptr @not_imported)
 
   ;; Calls ensure the functions are imported.
   call i32 @hidden_def_weak_def()
@@ -102,7 +102,7 @@ target triple = "x86_64-unknown-linux-gnu"
 
 define hidden i32 @hidden_def_weak_def() {
 entry:
-  %0 = load i32, i32* @var1
+  %0 = load i32, ptr @var1
   ret i32 %0
 }
 

diff  --git a/llvm/test/ThinLTO/X86/visibility-macho.ll b/llvm/test/ThinLTO/X86/visibility-macho.ll
index a299af901bf46..d41ab4f1ef398 100644
--- a/llvm/test/ThinLTO/X86/visibility-macho.ll
+++ b/llvm/test/ThinLTO/X86/visibility-macho.ll
@@ -24,7 +24,7 @@ target triple = "x86_64-apple-macosx10.15.0"
 @var1 = weak global i32 1, align 4
 @var2 = extern_weak global i32
 
-declare void @ext(void ()*)
+declare void @ext(ptr)
 
 ; CHECK: declare hidden i32 @hidden_def_weak_def()
 ;; Currently the visibility is not propagated onto an unimported function,
@@ -40,7 +40,7 @@ declare void @ext(void ()*)
 
 define weak i32 @hidden_def_weak_def() {
 entry:
-  %0 = load i32, i32* @var2
+  %0 = load i32, ptr @var2
   ret i32 %0
 }
 
@@ -51,10 +51,10 @@ declare extern_weak void @hidden_def_weak_ref()
 
 define i32 @main() {
 entry:
-  call void @ext(void ()* bitcast (i32 ()* @hidden_def_weak_def to void ()*))
-  call void @ext(void ()* @hidden_def_ref)
-  call void @ext(void ()* @hidden_def_weak_ref)
-  call void @ext(void ()* @not_imported)
+  call void @ext(ptr @hidden_def_weak_def)
+  call void @ext(ptr @hidden_def_ref)
+  call void @ext(ptr @hidden_def_weak_ref)
+  call void @ext(ptr @not_imported)
 
   ;; Calls ensure the functions are imported.
   call i32 @hidden_def_weak_def()
@@ -72,7 +72,7 @@ target triple = "x86_64-apple-macosx10.15.0"
 
 define hidden i32 @hidden_def_weak_def() {
 entry:
-  %0 = load i32, i32* @var1
+  %0 = load i32, ptr @var1
   ret i32 %0
 }
 

diff  --git a/llvm/test/ThinLTO/X86/weak_externals.ll b/llvm/test/ThinLTO/X86/weak_externals.ll
index c731cd5d533e7..02e7888027863 100644
--- a/llvm/test/ThinLTO/X86/weak_externals.ll
+++ b/llvm/test/ThinLTO/X86/weak_externals.ll
@@ -27,17 +27,16 @@ $_ZZN9SingletonI1SE11getInstanceEvE13instance_weak = comdat any
 
 @_ZZN9SingletonI1SE11getInstanceEvE8instance = linkonce_odr dso_local global %struct.S zeroinitializer, comdat, align 8
 
- at _ZZN9SingletonI1SE11getInstanceEvE13instance_weak = weak_odr dso_local global %struct.S* null, comdat, align 8
+ at _ZZN9SingletonI1SE11getInstanceEvE13instance_weak = weak_odr dso_local global ptr null, comdat, align 8
 
 define dso_local void @_ZL5initSv() {
-  %1 = call dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv()
-  store  %struct.S* %1, %struct.S** @_ZZN9SingletonI1SE11getInstanceEvE13instance_weak
-  %2 = getelementptr inbounds %struct.S, %struct.S* %1, i32 0, i32 0
-  store i64 1, i64* %2, align 8
+  %1 = call dereferenceable(16) ptr @_ZN9SingletonI1SE11getInstanceEv()
+  store  ptr %1, ptr @_ZZN9SingletonI1SE11getInstanceEvE13instance_weak
+  store i64 1, ptr %1, align 8
   ret void
 }
 
-define linkonce_odr dso_local dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv() #0 comdat align 2 {
-  ret %struct.S* @_ZZN9SingletonI1SE11getInstanceEvE8instance
+define linkonce_odr dso_local dereferenceable(16) ptr @_ZN9SingletonI1SE11getInstanceEv() #0 comdat align 2 {
+  ret ptr @_ZZN9SingletonI1SE11getInstanceEvE8instance
 }
 

diff  --git a/llvm/test/ThinLTO/X86/weak_resolution.ll b/llvm/test/ThinLTO/X86/weak_resolution.ll
index ccebb56f90deb..c7f24e4c4afb0 100644
--- a/llvm/test/ThinLTO/X86/weak_resolution.ll
+++ b/llvm/test/ThinLTO/X86/weak_resolution.ll
@@ -16,14 +16,14 @@ target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16
 target triple = "x86_64-apple-macosx10.11.0"
 
 ; Alias are resolved, but can't be turned into "available_externally"
-; MOD1: @linkonceodralias = weak_odr alias void (), void ()* @linkonceodrfuncwithalias
-; MOD2: @linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
- at linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
+; MOD1: @linkonceodralias = weak_odr alias void (), ptr @linkonceodrfuncwithalias
+; MOD2: @linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
+ at linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
 
 ; Alias are resolved, but can't be turned into "available_externally"
-; MOD1: @linkoncealias = weak alias void (), void ()* @linkoncefuncwithalias
-; MOD2: @linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
- at linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
+; MOD1: @linkoncealias = weak alias void (), ptr @linkoncefuncwithalias
+; MOD2: @linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
+ at linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
 
 ; Function with an alias are resolved to weak_odr in prevailing module, but
 ; not optimized in non-prevailing module (illegal to have an


        


More information about the llvm-commits mailing list