[llvm] 0ecf796 - [llvm] Update WPD tests to use opaque pointers

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 11 15:30:39 PDT 2022


Author: Leonard Chan
Date: 2022-10-11T22:30:24Z
New Revision: 0ecf7965929c4477c8b9821c68e0ad66b012d8fe

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

LOG: [llvm] Update WPD tests to use opaque pointers

Differential Revision: https://reviews.llvm.org/D135611

Added: 
    

Modified: 
    llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
    llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
    llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
    llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
    llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-multiple-assumes.ll
    llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
    llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl2.ll
    llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll
    llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
    llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
    llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
    llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
    llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
    llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
    llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
    llvm/test/Transforms/WholeProgramDevirt/import.ll
    llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
    llvm/test/Transforms/WholeProgramDevirt/uniform-retval-multiple-assumes.ll
    llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
    llvm/test/Transforms/WholeProgramDevirt/unique-retval-multiple-assumes.ll
    llvm/test/Transforms/WholeProgramDevirt/unique-retval-same-vtable.ll
    llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
    llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
    llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
    llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
    llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
    llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-multiple-assumes.ll
    llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll

Removed: 
    llvm/test/Transforms/WholeProgramDevirt/import-no-dominating-assume.ll


################################################################################
diff  --git a/llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
index 61bfe42de47c3..bb4abe4564d4b 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/bad-read-from-vtable.ll
@@ -3,78 +3,61 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [2 x i8*] [i8* zeroinitializer, i8* bitcast (void (i8*)* @vf to i8*)], !type !0
- at vt2 = constant i8* bitcast (void (i8*)* @vf to i8*), !type !1
+ at vt1 = constant [2 x ptr] [ptr zeroinitializer, ptr @vf], !type !0
+ at vt2 = constant ptr @vf, !type !1
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @unaligned1
-define void @unaligned1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @unaligned1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr i8, i8* %vtablei8, i32 1
-  %fptrptr_casted = bitcast i8* %fptrptr to i8**
-  %fptr = load i8*, i8** %fptrptr_casted
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptrptr = getelementptr i8, ptr %vtable, i32 1
+  %fptr = load ptr, ptr %fptrptr
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @unaligned2
-define void @unaligned2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define void @unaligned2(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 i8, i8* %vtablei8, i32 1
-  %fptrptr_casted = bitcast i8* %fptrptr to i8**
-  %fptr = load i8*, i8** %fptrptr_casted
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptrptr = getelementptr i8, ptr %vtable, i32 1
+  %fptr = load ptr, ptr %fptrptr
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @outofbounds
-define void @outofbounds(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @outofbounds(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr i8, i8* %vtablei8, i32 16
-  %fptrptr_casted = bitcast i8* %fptrptr to i8**
-  %fptr = load i8*, i8** %fptrptr_casted
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptrptr = getelementptr i8, ptr %vtable, i32 16
+  %fptr = load ptr, ptr %fptrptr
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @nonfunction
-define void @nonfunction(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @nonfunction(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr i8, i8* %vtablei8, i32 0
-  %fptrptr_casted = bitcast i8* %fptrptr to i8**
-  %fptr = load i8*, i8** %fptrptr_casted
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
index 4a658a01d9272..dc5b22b8c3ce1 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel-threshold.ll
@@ -7,88 +7,76 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1_1 to i8*)], !type !0
- at vt1_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1_2 to i8*)], !type !0
-
-declare i32 @vf1_1(i8* %this, i32 %arg)
-declare i32 @vf1_2(i8* %this, i32 %arg)
-
- at vt2_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_1 to i8*)], !type !1
- at vt2_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_2 to i8*)], !type !1
- at vt2_3 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_3 to i8*)], !type !1
- at vt2_4 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_4 to i8*)], !type !1
- at vt2_5 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_5 to i8*)], !type !1
- at vt2_6 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_6 to i8*)], !type !1
- at vt2_7 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_7 to i8*)], !type !1
- at vt2_8 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_8 to i8*)], !type !1
- at vt2_9 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_9 to i8*)], !type !1
- at vt2_10 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_10 to i8*)], !type !1
- at vt2_11 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_11 to i8*)], !type !1
-
-declare i32 @vf2_1(i8* %this, i32 %arg)
-declare i32 @vf2_2(i8* %this, i32 %arg)
-declare i32 @vf2_3(i8* %this, i32 %arg)
-declare i32 @vf2_4(i8* %this, i32 %arg)
-declare i32 @vf2_5(i8* %this, i32 %arg)
-declare i32 @vf2_6(i8* %this, i32 %arg)
-declare i32 @vf2_7(i8* %this, i32 %arg)
-declare i32 @vf2_8(i8* %this, i32 %arg)
-declare i32 @vf2_9(i8* %this, i32 %arg)
-declare i32 @vf2_10(i8* %this, i32 %arg)
-declare i32 @vf2_11(i8* %this, i32 %arg)
-
- at vt3_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf3_1 to i8*)], !type !2
- at vt3_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf3_2 to i8*)], !type !2
-
-declare i32 @vf3_1(i8* %this, i32 %arg)
-declare i32 @vf3_2(i8* %this, i32 %arg)
-
- at vt4_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf4_1 to i8*)], !type !3
- at vt4_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf4_2 to i8*)], !type !3
-
-declare i32 @vf4_1(i8* %this, i32 %arg)
-declare i32 @vf4_2(i8* %this, i32 %arg)
-
-define i32 @fn1(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+ at vt1_1 = constant [1 x ptr] [ptr @vf1_1], !type !0
+ at vt1_2 = constant [1 x ptr] [ptr @vf1_2], !type !0
+
+declare i32 @vf1_1(ptr %this, i32 %arg)
+declare i32 @vf1_2(ptr %this, i32 %arg)
+
+ at vt2_1 = constant [1 x ptr] [ptr @vf2_1], !type !1
+ at vt2_2 = constant [1 x ptr] [ptr @vf2_2], !type !1
+ at vt2_3 = constant [1 x ptr] [ptr @vf2_3], !type !1
+ at vt2_4 = constant [1 x ptr] [ptr @vf2_4], !type !1
+ at vt2_5 = constant [1 x ptr] [ptr @vf2_5], !type !1
+ at vt2_6 = constant [1 x ptr] [ptr @vf2_6], !type !1
+ at vt2_7 = constant [1 x ptr] [ptr @vf2_7], !type !1
+ at vt2_8 = constant [1 x ptr] [ptr @vf2_8], !type !1
+ at vt2_9 = constant [1 x ptr] [ptr @vf2_9], !type !1
+ at vt2_10 = constant [1 x ptr] [ptr @vf2_10], !type !1
+ at vt2_11 = constant [1 x ptr] [ptr @vf2_11], !type !1
+
+declare i32 @vf2_1(ptr %this, i32 %arg)
+declare i32 @vf2_2(ptr %this, i32 %arg)
+declare i32 @vf2_3(ptr %this, i32 %arg)
+declare i32 @vf2_4(ptr %this, i32 %arg)
+declare i32 @vf2_5(ptr %this, i32 %arg)
+declare i32 @vf2_6(ptr %this, i32 %arg)
+declare i32 @vf2_7(ptr %this, i32 %arg)
+declare i32 @vf2_8(ptr %this, i32 %arg)
+declare i32 @vf2_9(ptr %this, i32 %arg)
+declare i32 @vf2_10(ptr %this, i32 %arg)
+declare i32 @vf2_11(ptr %this, i32 %arg)
+
+ at vt3_1 = constant [1 x ptr] [ptr @vf3_1], !type !2
+ at vt3_2 = constant [1 x ptr] [ptr @vf3_2], !type !2
+
+declare i32 @vf3_1(ptr %this, i32 %arg)
+declare i32 @vf3_2(ptr %this, i32 %arg)
+
+ at vt4_1 = constant [1 x ptr] [ptr @vf4_1], !type !3
+ at vt4_2 = constant [1 x ptr] [ptr @vf4_2], !type !3
+
+declare i32 @vf4_1(ptr %this, i32 %arg)
+declare i32 @vf4_2(ptr %this, i32 %arg)
+
+define i32 @fn1(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
-define i32 @fn2(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i32 @fn2(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
-define i32 @fn3(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !4)
+define i32 @fn3(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !4)
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
index fa7cecdf9c6fa..b55713fe4b296 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/branch-funnel.ll
@@ -51,108 +51,94 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1_1 to i8*)], !type !0
- at vt1_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1_2 to i8*)], !type !0
-
-declare i32 @vf1_1(i8* %this, i32 %arg)
-declare i32 @vf1_2(i8* %this, i32 %arg)
-
- at vt2_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_1 to i8*)], !type !1
- at vt2_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_2 to i8*)], !type !1
- at vt2_3 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_3 to i8*)], !type !1
- at vt2_4 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_4 to i8*)], !type !1
- at vt2_5 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_5 to i8*)], !type !1
- at vt2_6 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_6 to i8*)], !type !1
- at vt2_7 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_7 to i8*)], !type !1
- at vt2_8 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_8 to i8*)], !type !1
- at vt2_9 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_9 to i8*)], !type !1
- at vt2_10 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_10 to i8*)], !type !1
- at vt2_11 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2_11 to i8*)], !type !1
-
-declare i32 @vf2_1(i8* %this, i32 %arg)
-declare i32 @vf2_2(i8* %this, i32 %arg)
-declare i32 @vf2_3(i8* %this, i32 %arg)
-declare i32 @vf2_4(i8* %this, i32 %arg)
-declare i32 @vf2_5(i8* %this, i32 %arg)
-declare i32 @vf2_6(i8* %this, i32 %arg)
-declare i32 @vf2_7(i8* %this, i32 %arg)
-declare i32 @vf2_8(i8* %this, i32 %arg)
-declare i32 @vf2_9(i8* %this, i32 %arg)
-declare i32 @vf2_10(i8* %this, i32 %arg)
-declare i32 @vf2_11(i8* %this, i32 %arg)
-
- at vt3_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf3_1 to i8*)], !type !2
- at vt3_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf3_2 to i8*)], !type !2
-
-declare i32 @vf3_1(i8* %this, i32 %arg)
-declare i32 @vf3_2(i8* %this, i32 %arg)
-
- at vt4_1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf4_1 to i8*)], !type !3
- at vt4_2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf4_2 to i8*)], !type !3
-
-declare i32 @vf4_1(i8* %this, i32 %arg)
-declare i32 @vf4_2(i8* %this, i32 %arg)
+ at vt1_1 = constant [1 x ptr] [ptr @vf1_1], !type !0
+ at vt1_2 = constant [1 x ptr] [ptr @vf1_2], !type !0
+
+declare i32 @vf1_1(ptr %this, i32 %arg)
+declare i32 @vf1_2(ptr %this, i32 %arg)
+
+ at vt2_1 = constant [1 x ptr] [ptr @vf2_1], !type !1
+ at vt2_2 = constant [1 x ptr] [ptr @vf2_2], !type !1
+ at vt2_3 = constant [1 x ptr] [ptr @vf2_3], !type !1
+ at vt2_4 = constant [1 x ptr] [ptr @vf2_4], !type !1
+ at vt2_5 = constant [1 x ptr] [ptr @vf2_5], !type !1
+ at vt2_6 = constant [1 x ptr] [ptr @vf2_6], !type !1
+ at vt2_7 = constant [1 x ptr] [ptr @vf2_7], !type !1
+ at vt2_8 = constant [1 x ptr] [ptr @vf2_8], !type !1
+ at vt2_9 = constant [1 x ptr] [ptr @vf2_9], !type !1
+ at vt2_10 = constant [1 x ptr] [ptr @vf2_10], !type !1
+ at vt2_11 = constant [1 x ptr] [ptr @vf2_11], !type !1
+
+declare i32 @vf2_1(ptr %this, i32 %arg)
+declare i32 @vf2_2(ptr %this, i32 %arg)
+declare i32 @vf2_3(ptr %this, i32 %arg)
+declare i32 @vf2_4(ptr %this, i32 %arg)
+declare i32 @vf2_5(ptr %this, i32 %arg)
+declare i32 @vf2_6(ptr %this, i32 %arg)
+declare i32 @vf2_7(ptr %this, i32 %arg)
+declare i32 @vf2_8(ptr %this, i32 %arg)
+declare i32 @vf2_9(ptr %this, i32 %arg)
+declare i32 @vf2_10(ptr %this, i32 %arg)
+declare i32 @vf2_11(ptr %this, i32 %arg)
+
+ at vt3_1 = constant [1 x ptr] [ptr @vf3_1], !type !2
+ at vt3_2 = constant [1 x ptr] [ptr @vf3_2], !type !2
+
+declare i32 @vf3_1(ptr %this, i32 %arg)
+declare i32 @vf3_2(ptr %this, i32 %arg)
+
+ at vt4_1 = constant [1 x ptr] [ptr @vf4_1], !type !3
+ at vt4_2 = constant [1 x ptr] [ptr @vf4_2], !type !3
+
+declare i32 @vf4_1(ptr %this, i32 %arg)
+declare i32 @vf4_2(ptr %this, i32 %arg)
 
 
 
 ; CHECK-LABEL: define i32 @fn1
 ; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
-define i32 @fn1(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define i32 @fn1(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  ; RETP: {{.*}} = bitcast {{.*}} to i8*
-  ; RETP: [[VT1:%.*]] = bitcast {{.*}} to i8*
-  ; RETP: call i32 bitcast (void (i8*, ...)* @__typeid_typeid1_0_branch_funnel to i32 (i8*, i8*, i32)*)(i8* nest [[VT1]], i8* %obj, i32 1)
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  ; RETP: call i32 @__typeid_typeid1_0_branch_funnel(ptr nest %vtable, ptr %obj, i32 1)
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ; NORETP: call i32 %
   ret i32 %result
 }
 
 ; CHECK-LABEL: define i32 @fn2
 ; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
-define i32 @fn2(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i32 @fn2(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
 ; CHECK-LABEL: define i32 @fn3
 ; CHECK-NOT: call void (...) @llvm.icall.branch.funnel
-define i32 @fn3(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !4)
+define i32 @fn3(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !4)
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  ; RETP: call i32 bitcast (void (i8*, ...)* @branch_funnel to
+  %fptr = load ptr, ptr %vtable
+  ; RETP: call i32 @branch_funnel(ptr
   ; NORETP: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
-; CHECK-LABEL: define hidden void @__typeid_typeid1_0_branch_funnel(i8* nest %0, ...)
-; CHECK-NEXT: musttail call void (...) @llvm.icall.branch.funnel(i8* %0, i8* {{(nonnull )?}}bitcast ([1 x i8*]* @vt1_1 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_1, i8* {{(nonnull )?}}bitcast ([1 x i8*]* @vt1_2 to i8*), i32 (i8*, i32)* {{(nonnull )?}}@vf1_2, ...)
+; CHECK-LABEL: define hidden void @__typeid_typeid1_0_branch_funnel(ptr nest %0, ...)
+; CHECK-NEXT: musttail call void (...) @llvm.icall.branch.funnel(ptr %0, ptr {{(nonnull )?}}@vt1_1, ptr {{(nonnull )?}}@vf1_1, ptr {{(nonnull )?}}@vt1_2, ptr {{(nonnull )?}}@vf1_2, ...)
 
-; CHECK: define internal void @branch_funnel(i8*
+; CHECK: define internal void @branch_funnel(ptr
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll b/llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
index 0fa60951ad76e..91bae4af9a211 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/constant-arg.ll
@@ -3,73 +3,65 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: private constant { [8 x i8], [1 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf1 to i8*)], [0 x i8] zeroinitializer }, !type [[T8:![0-9]+]]
-; CHECK: private constant { [8 x i8], [1 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\02", [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf2 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
-; CHECK: private constant { [8 x i8], [1 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf4 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
-; CHECK: private constant { [8 x i8], [1 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\02", [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf8 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
+; CHECK: private constant { [8 x i8], [1 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", [1 x ptr] [ptr @vf1], [0 x i8] zeroinitializer }, !type [[T8:![0-9]+]]
+; CHECK: private constant { [8 x i8], [1 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\02", [1 x ptr] [ptr @vf2], [0 x i8] zeroinitializer }, !type [[T8]]
+; CHECK: private constant { [8 x i8], [1 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", [1 x ptr] [ptr @vf4], [0 x i8] zeroinitializer }, !type [[T8]]
+; CHECK: private constant { [8 x i8], [1 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\02", [1 x ptr] [ptr @vf8], [0 x i8] zeroinitializer }, !type [[T8]]
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf2 to i8*)], !type !0
- at vt4 = constant [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf4 to i8*)], !type !0
- at vt8 = constant [1 x i8*] [i8* bitcast (i1 (i8*, i32)* @vf8 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
+ at vt4 = constant [1 x ptr] [ptr @vf4], !type !0
+ at vt8 = constant [1 x ptr] [ptr @vf8], !type !0
 
-define i1 @vf1(i8* %this, i32 %arg) readnone {
+define i1 @vf1(ptr %this, i32 %arg) readnone {
   %and = and i32 %arg, 1
   %cmp = icmp ne i32 %and, 0
   ret i1 %cmp
 }
 
-define i1 @vf2(i8* %this, i32 %arg) readnone {
+define i1 @vf2(ptr %this, i32 %arg) readnone {
   %and = and i32 %arg, 2
   %cmp = icmp ne i32 %and, 0
   ret i1 %cmp
 }
 
-define i1 @vf4(i8* %this, i32 %arg) readnone {
+define i1 @vf4(ptr %this, i32 %arg) readnone {
   %and = and i32 %arg, 4
   %cmp = icmp ne i32 %and, 0
   ret i1 %cmp
 }
 
-define i1 @vf8(i8* %this, i32 %arg) readnone {
+define i1 @vf8(ptr %this, i32 %arg) readnone {
   %and = and i32 %arg, 8
   %cmp = icmp ne i32 %and, 0
   ret i1 %cmp
 }
 
 ; CHECK: define i1 @call1
-define i1 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: getelementptr {{.*}} -1
   ; CHECK: and {{.*}}, 1
-  %result = call i1 %fptr_casted(i8* %obj, i32 5)
+  %result = call i1 %fptr(ptr %obj, i32 5)
   ret i1 %result
 }
 
 ; CHECK: define i1 @call2
-define i1 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: getelementptr {{.*}} -1
   ; CHECK: and {{.*}}, 2
-  %result = call i1 %fptr_casted(i8* %obj, i32 10)
+  %result = call i1 %fptr(ptr %obj, i32 10)
   ret i1 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 ; CHECK: [[T8]] = !{i32 8, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
index a5c23c302ac94..dc7b2024bc591 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
@@ -7,28 +7,25 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: remark: <unknown>:0:0: devirtualized vf
 ; CHECK-NOT: devirtualized
 
- at vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf], !type !0
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 0, metadata !"typeid")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %p = extractvalue {i8*, i1} %pair, 1
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 0, metadata !"typeid")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  %p = extractvalue {ptr, i1} %pair, 1
   ; CHECK: br i1 true,
   br i1 %p, label %cont, label %trap
 
 cont:
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
   ; CHECK: call void @vf(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 
 trap:
@@ -36,7 +33,7 @@ trap:
   unreachable
 }
 
-declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
+declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
 declare void @llvm.trap()
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-multiple-assumes.ll b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-multiple-assumes.ll
index 191e6fb2b694e..ed144c23302dd 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-multiple-assumes.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl-multiple-assumes.ll
@@ -3,31 +3,27 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf], !type !0
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %p2 = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+  %p2 = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p2)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
index 85afe434c12e2..1ce96f70d905f 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl.ll
@@ -10,29 +10,25 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: remark: devirt-single.cc:13:0: devirtualized vf
 ; CHECK-NOT: devirtualized
 
- at vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !8
- at vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !8
+ at vt1 = constant [1 x ptr] [ptr @vf], !type !8
+ at vt2 = constant [1 x ptr] [ptr @vf], !type !8
 
-define void @vf(i8* %this) #0 !dbg !7 {
+define void @vf(ptr %this) #0 !dbg !7 {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) #1 !dbg !5 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj) #1 !dbg !5 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf(
-  call void %fptr_casted(i8* %obj), !dbg !6
+  call void %fptr(ptr %obj), !dbg !6
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !llvm.dbg.cu = !{!0}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl2.ll b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl2.ll
index f9d767d7c178d..650e68a99fd4a 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl2.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/devirt-single-impl2.ll
@@ -22,13 +22,13 @@ source_filename = "ld-temp.o"
 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 }
 
 $_ZTV1A = comdat any
 
- at _ZTV1A = weak_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 _ZTI1A = external hidden constant { i8*, i8* }, align 8
-define available_externally hidden i32 @_ZNK1A1fEv(%struct.A* %this) unnamed_addr align 2 {
+ at _ZTV1A = weak_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 _ZTI1A = external hidden constant { ptr, ptr }, align 8
+define available_externally hidden i32 @_ZNK1A1fEv(ptr %this) unnamed_addr align 2 {
 entry:
   ret i32 3
 }

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll b/llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll
index 994a3b58e75cd..457120b9c6f41 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/devirt_single_after_filtering_unreachable_function.ll
@@ -12,34 +12,31 @@ 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, !type !2, !type !3
- at _ZTV4Base = constant { [3 x i8*] } { [3 x i8*] [ i8* null, i8* null, i8* bitcast (void (%Base*)* @_ZN4BaseD0Ev to i8*)] }, !type !0, !type !1
+ at _ZTV7Derived = constant { [3 x ptr] } { [3 x ptr] [ ptr null, ptr null, ptr @_ZN7DerivedD0Ev] }, !type !0, !type !1, !type !2, !type !3
+ at _ZTV4Base = constant { [3 x ptr] } { [3 x ptr] [ ptr null, ptr null, ptr @_ZN4BaseD0Ev] }, !type !0, !type !1
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 declare void @llvm.assume(i1)
 
-define i32 @func(%Base* %b) {
+define i32 @func(ptr %b) {
 entry:
-  %0 = bitcast %Base* %b to void (%Base*)***, !dbg !11
-  %vtable = load void (%Base*)**, void (%Base*)*** %0, !dbg !11
-  %1 = bitcast void (%Base*)** %vtable to i8*, !dbg !11
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS4Base"), !dbg !11
-  tail call void @llvm.assume(i1 %2), !dbg !11
-  %vfn = getelementptr inbounds void (%Base*)*, void (%Base*)** %vtable, i64 0, !dbg !11
-  %3 = load void (%Base*)*, void (%Base*)** %vfn, !dbg !11
-  tail call void %3(%Base* %b), !dbg !11
+  %vtable = load ptr, ptr %b, !dbg !11
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS4Base"), !dbg !11
+  tail call void @llvm.assume(i1 %0), !dbg !11
+  %1 = load ptr, ptr %vtable, !dbg !11
+  tail call void %1(ptr %b), !dbg !11
   ret i32 0
 }
 
-define void @_ZN7DerivedD0Ev(%Derived* %this) {
+define void @_ZN7DerivedD0Ev(ptr %this) {
 entry:
   ret void
 }
 
-define void @_ZN4BaseD0Ev(%Base* %this) {
+define void @_ZN4BaseD0Ev(ptr %this) {
 entry:
   tail call void @llvm.trap()
   unreachable

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/expand-check.ll b/llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
index 16cfd454eb8d8..f92cfccf9d23e 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/expand-check.ll
@@ -6,37 +6,32 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (void (i8*)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define void @vf1(i8* %this) {
+define void @vf1(ptr %this) {
   ret void
 }
 
-define void @vf2(i8* %this) {
+define void @vf2(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 0, metadata !"typeid")
-  %p = extractvalue {i8*, i1} %pair, 1
-  ; CHECK: [[TT:%[^ ]*]] = call i1 @llvm.type.test(i8* [[VT:%[^,]*]], metadata !"typeid")
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 0, metadata !"typeid")
+  %p = extractvalue {ptr, i1} %pair, 1
+  ; CHECK: [[TT:%[^ ]*]] = call i1 @llvm.type.test(ptr [[VT:%[^,]*]], metadata !"typeid")
   ; CHECK: br i1 [[TT]],
   br i1 %p, label %cont, label %trap
 
 cont:
-  ; CHECK: [[GEP:%[^ ]*]] = getelementptr i8, i8* [[VT]], i32 0
-  ; CHECK: [[BC:%[^ ]*]] = bitcast i8* [[GEP]] to i8**
-  ; CHECK: [[LOAD:%[^ ]*]] = load i8*, i8** [[BC]]
-  ; CHECK: [[FPC:%[^ ]*]] = bitcast i8* [[LOAD]] to void (i8*)*
-  ; CHECK: call void [[FPC]]
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
-  call void %fptr_casted(i8* %obj)
+  ; CHECK: [[GEP:%[^ ]*]] = getelementptr i8, ptr [[VT]], i32 0
+  ; CHECK: [[LOAD:%[^ ]*]] = load ptr, ptr [[GEP]]
+  ; CHECK: call void [[LOAD]]
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  call void %fptr(ptr %obj)
   ret void
 
 trap:
@@ -44,20 +39,19 @@ trap:
   unreachable
 }
 
-; CHECK: define { i8*, i1 } @ret
-define {i8*, i1} @ret(i8* %vtablei8) {
-  ; CHECK: [[GEP2:%[^ ]*]] = getelementptr i8, i8* [[VT2:%[^,]*]], i32 1
-  ; CHECK: [[BC2:%[^ ]*]] = bitcast i8* [[GEP2]] to i8**
-  ; CHECK: [[LOAD2:%[^ ]*]] = load i8*, i8** [[BC2]]
-  ; CHECK: [[TT2:%[^ ]*]] = call i1 @llvm.type.test(i8* [[VT2]], metadata !"typeid")
-  ; CHECK: [[I1:%[^ ]*]] = insertvalue { i8*, i1 } poison, i8* [[LOAD2]], 0
-  ; CHECK: [[I2:%[^ ]*]] = insertvalue { i8*, i1 } %5, i1 [[TT2]], 1
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 1, metadata !"typeid")
-  ; CHECK: ret { i8*, i1 } [[I2]]
-  ret {i8*, i1} %pair
+; CHECK: define { ptr, i1 } @ret
+define {ptr, i1} @ret(ptr %vtablei8) {
+  ; CHECK: [[GEP2:%[^ ]*]] = getelementptr i8, ptr [[VT2:%[^,]*]], i32 1
+  ; CHECK: [[LOAD2:%[^ ]*]] = load ptr, ptr [[GEP2]]
+  ; CHECK: [[TT2:%[^ ]*]] = call i1 @llvm.type.test(ptr %vtablei8, metadata !"typeid")
+  ; CHECK: [[I1:%[^ ]*]] = insertvalue { ptr, i1 } poison, ptr [[LOAD2]], 0
+  ; CHECK: [[I2:%[^ ]*]] = insertvalue { ptr, i1 } [[I1]], i1 [[TT2]], 1
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtablei8, i32 1, metadata !"typeid")
+  ; CHECK: ret { ptr, i1 } [[I2]]
+  ret {ptr, i1} %pair
 }
 
-declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
+declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
 declare void @llvm.trap()
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll b/llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
index bcbbeb6bffe53..c27b4b34ac04e 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/export-single-impl.ll
@@ -60,38 +60,38 @@
 ; CHECK: $vf4.llvm.merged = comdat largest
 $vf4 = comdat largest
 
-; CHECK: @vt1 = constant void (i8*)* @vf1
- at vt1 = constant void (i8*)* @vf1, !type !0
+; CHECK: @vt1 = constant ptr @vf1
+ at vt1 = constant ptr @vf1, !type !0
 
-; CHECK: @vt2 = constant void (i8*)* @vf2
- at vt2 = constant void (i8*)* @vf2, !type !1
+; CHECK: @vt2 = constant ptr @vf2
+ at vt2 = constant ptr @vf2, !type !1
 
- at vt3 = constant void (i8*)* @vf3, !type !2
+ at vt3 = constant ptr @vf3, !type !2
 
-; CHECK: @vt4 = constant void (i8*)* @vf4.llvm.merged, comdat($vf4.llvm.merged)
- at vt4 = constant void (i8*)* @vf4, comdat($vf4), !type !3
+; CHECK: @vt4 = constant ptr @vf4.llvm.merged, comdat($vf4.llvm.merged)
+ at vt4 = constant ptr @vf4, comdat($vf4), !type !3
 
- at vt5 = constant void (i8*)* @vf5, !type !4
+ at vt5 = constant ptr @vf5, !type !4
 
-; CHECK: declare void @vf1(i8*)
-declare void @vf1(i8*)
+; CHECK: declare void @vf1(ptr)
+declare void @vf1(ptr)
 
-; CHECK: define void @vf2(i8* %0)
-define void @vf2(i8*) {
+; CHECK: define void @vf2(ptr %0)
+define void @vf2(ptr) {
   ret void
 }
 
-; CHECK: define hidden void @vf3.llvm.merged(i8* %0) {
-define internal void @vf3(i8*) {
+; CHECK: define hidden void @vf3.llvm.merged(ptr %0) {
+define internal void @vf3(ptr) {
   ret void
 }
 
-; CHECK: define hidden void @vf4.llvm.merged(i8* %0) comdat {
-define internal void @vf4(i8*) comdat {
+; CHECK: define hidden void @vf4.llvm.merged(ptr %0) comdat {
+define internal void @vf4(ptr) comdat {
   ret void
 }
 
-declare void @vf5(i8*)
+declare void @vf5(ptr)
 
 !0 = !{i32 0, !"typeid1"}
 !1 = !{i32 0, !"typeid2"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll b/llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
index 744c347eb1f8e..5d148ca8e1980 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/export-uniform-ret-val.ll
@@ -23,18 +23,18 @@
 ; SUMMARY-NEXT:             Byte:            0
 ; SUMMARY-NEXT:             Bit:             0
 
-; CHECK: @vt4a = constant i32 (i8*, i32, i32)* @vf4a
- at vt4a = constant i32 (i8*, i32, i32)* @vf4a, !type !0
+; CHECK: @vt4a = constant ptr @vf4a
+ at vt4a = constant ptr @vf4a, !type !0
 
-; CHECK: @vt4b = constant i32 (i8*, i32, i32)* @vf4b
- at vt4b = constant i32 (i8*, i32, i32)* @vf4b, !type !0
+; CHECK: @vt4b = constant ptr @vf4b
+ at vt4b = constant ptr @vf4b, !type !0
 
-define i32 @vf4a(i8*, i32 %x, i32 %y) {
+define i32 @vf4a(ptr, i32 %x, i32 %y) {
   %z = add i32 %x, %y
   ret i32 %z
 }
 
-define i32 @vf4b(i8*, i32 %x, i32 %y) {
+define i32 @vf4b(ptr, i32 %x, i32 %y) {
   ret i32 36
 }
 

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll b/llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
index d722519b9347c..deaf34651354d 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/export-unique-ret-val.ll
@@ -41,48 +41,48 @@
 ; SUMMARY-NEXT:             Byte:            0
 ; SUMMARY-NEXT:             Bit:             0
 
-; CHECK: @vt3a = constant i1 (i8*, i32, i32)* @vf3a
- at vt3a = constant i1 (i8*, i32, i32)* @vf3a, !type !0
+; CHECK: @vt3a = constant ptr @vf3a
+ at vt3a = constant ptr @vf3a, !type !0
 
-; CHECK: @vt3b = constant i1 (i8*, i32, i32)* @vf3b
- at vt3b = constant i1 (i8*, i32, i32)* @vf3b, !type !0
+; CHECK: @vt3b = constant ptr @vf3b
+ at vt3b = constant ptr @vf3b, !type !0
 
-; CHECK: @vt3c = constant i1 (i8*, i32, i32)* @vf3c
- at vt3c = constant i1 (i8*, i32, i32)* @vf3c, !type !0
+; CHECK: @vt3c = constant ptr @vf3c
+ at vt3c = constant ptr @vf3c, !type !0
 
-; CHECK: @vt4a = constant i1 (i8*, i32, i32)* @vf4a
- at vt4a = constant i1 (i8*, i32, i32)* @vf4a, !type !1
+; CHECK: @vt4a = constant ptr @vf4a
+ at vt4a = constant ptr @vf4a, !type !1
 
-; CHECK: @vt4b = constant i1 (i8*, i32, i32)* @vf4b
- at vt4b = constant i1 (i8*, i32, i32)* @vf4b, !type !1
+; CHECK: @vt4b = constant ptr @vf4b
+ at vt4b = constant ptr @vf4b, !type !1
 
-; CHECK: @vt4c = constant i1 (i8*, i32, i32)* @vf4c
- at vt4c = constant i1 (i8*, i32, i32)* @vf4c, !type !1
+; CHECK: @vt4c = constant ptr @vf4c
+ at vt4c = constant ptr @vf4c, !type !1
 
-; CHECK: @__typeid_typeid3_0_12_24_unique_member = hidden alias i8, bitcast (i1 (i8*, i32, i32)** @vt3b to i8*)
-; CHECK: @__typeid_typeid4_0_24_12_unique_member = hidden alias i8, bitcast (i1 (i8*, i32, i32)** @vt4b to i8*)
+; CHECK: @__typeid_typeid3_0_12_24_unique_member = hidden alias i8, ptr @vt3b
+; CHECK: @__typeid_typeid4_0_24_12_unique_member = hidden alias i8, ptr @vt4b
 
-define i1 @vf3a(i8*, i32, i32) {
+define i1 @vf3a(ptr, i32, i32) {
   ret i1 true
 }
 
-define i1 @vf3b(i8*, i32, i32) {
+define i1 @vf3b(ptr, i32, i32) {
   ret i1 false
 }
 
-define i1 @vf3c(i8*, i32, i32) {
+define i1 @vf3c(ptr, i32, i32) {
   ret i1 true
 }
 
-define i1 @vf4a(i8*, i32, i32) {
+define i1 @vf4a(ptr, i32, i32) {
   ret i1 false
 }
 
-define i1 @vf4b(i8*, i32, i32) {
+define i1 @vf4b(ptr, i32, i32) {
   ret i1 true
 }
 
-define i1 @vf4c(i8*, i32, i32) {
+define i1 @vf4c(ptr, i32, i32) {
   ret i1 false
 }
 

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll b/llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
index 516dbedcd54f8..a74f8974dcea3 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/export-unsuccessful-checked.ll
@@ -4,23 +4,23 @@
 ; CHECK:       TypeTests: [ 15427464259790519041, 17525413373118030901 ]
 ; CHECK-NEXT:  TypeTestAssumeVCalls:
 
- at vt1a = constant void (i8*)* @vf1a, !type !0
- at vt1b = constant void (i8*)* @vf1b, !type !0
- at vt2a = constant void (i8*)* @vf2a, !type !1
- at vt2b = constant void (i8*)* @vf2b, !type !1
- at vt3a = constant void (i8*)* @vf3a, !type !2
- at vt3b = constant void (i8*)* @vf3b, !type !2
- at vt4a = constant void (i8*)* @vf4a, !type !3
- at vt4b = constant void (i8*)* @vf4b, !type !3
+ at vt1a = constant ptr @vf1a, !type !0
+ at vt1b = constant ptr @vf1b, !type !0
+ at vt2a = constant ptr @vf2a, !type !1
+ at vt2b = constant ptr @vf2b, !type !1
+ at vt3a = constant ptr @vf3a, !type !2
+ at vt3b = constant ptr @vf3b, !type !2
+ at vt4a = constant ptr @vf4a, !type !3
+ at vt4b = constant ptr @vf4b, !type !3
 
-declare void @vf1a(i8*)
-declare void @vf1b(i8*)
-declare void @vf2a(i8*)
-declare void @vf2b(i8*)
-declare void @vf3a(i8*)
-declare void @vf3b(i8*)
-declare void @vf4a(i8*)
-declare void @vf4b(i8*)
+declare void @vf1a(ptr)
+declare void @vf1b(ptr)
+declare void @vf2a(ptr)
+declare void @vf2b(ptr)
+declare void @vf3a(ptr)
+declare void @vf3b(ptr)
+declare void @vf4a(ptr)
+declare void @vf4b(ptr)
 
 !0 = !{i32 0, !"typeid1"}
 !1 = !{i32 0, !"typeid2"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll b/llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
index a2ec7ad9ab279..24aba548ea9ac 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/export-vcp.ll
@@ -48,50 +48,50 @@ target datalayout = "e-p:64:64"
 ; SUMMARY-ARM-NEXT:         Byte:            4294967292
 ; SUMMARY-ARM-NEXT:         Bit:             1
 
-; CHECK: [[CVT3A:.*]] = private constant { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] zeroinitializer, i1 (i8*, i32, i32)* @vf0i1, [0 x i8] zeroinitializer }, !type !0
- at vt3a = constant i1 (i8*, i32, i32)* @vf0i1, !type !0
+; CHECK: [[CVT3A:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] zeroinitializer, ptr @vf0i1, [0 x i8] zeroinitializer }, !type !0
+ at vt3a = constant ptr @vf0i1, !type !0
 
-; CHECK: [[CVT3B:.*]] = private constant { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", i1 (i8*, i32, i32)* @vf1i1, [0 x i8] zeroinitializer }, !type !0
- at vt3b = constant i1 (i8*, i32, i32)* @vf1i1, !type !0
+; CHECK: [[CVT3B:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", ptr @vf1i1, [0 x i8] zeroinitializer }, !type !0
+ at vt3b = constant ptr @vf1i1, !type !0
 
-; CHECK: [[CVT3C:.*]] = private constant { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] zeroinitializer, i1 (i8*, i32, i32)* @vf0i1, [0 x i8] zeroinitializer }, !type !0
- at vt3c = constant i1 (i8*, i32, i32)* @vf0i1, !type !0
+; CHECK: [[CVT3C:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] zeroinitializer, ptr @vf0i1, [0 x i8] zeroinitializer }, !type !0
+ at vt3c = constant ptr @vf0i1, !type !0
 
-; CHECK: [[CVT3D:.*]] = private constant { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", i1 (i8*, i32, i32)* @vf1i1, [0 x i8] zeroinitializer }, !type !0
- at vt3d = constant i1 (i8*, i32, i32)* @vf1i1, !type !0
+; CHECK: [[CVT3D:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] c"\00\00\00\00\00\00\00\01", ptr @vf1i1, [0 x i8] zeroinitializer }, !type !0
+ at vt3d = constant ptr @vf1i1, !type !0
 
-; CHECK: [[CVT4A:.*]] = private constant { [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] c"\00\00\00\00\01\00\00\00", i32 (i8*, i32, i32)* @vf1i32, [0 x i8] zeroinitializer }, !type !1
- at vt4a = constant i32 (i8*, i32, i32)* @vf1i32, !type !1
+; CHECK: [[CVT4A:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] c"\00\00\00\00\01\00\00\00", ptr @vf1i32, [0 x i8] zeroinitializer }, !type !1
+ at vt4a = constant ptr @vf1i32, !type !1
 
-; CHECK: [[CVT4B:.*]] = private constant { [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] } { [8 x i8] c"\00\00\00\00\02\00\00\00", i32 (i8*, i32, i32)* @vf2i32, [0 x i8] zeroinitializer }, !type !1
- at vt4b = constant i32 (i8*, i32, i32)* @vf2i32, !type !1
+; CHECK: [[CVT4B:.*]] = private constant { [8 x i8], ptr, [0 x i8] } { [8 x i8] c"\00\00\00\00\02\00\00\00", ptr @vf2i32, [0 x i8] zeroinitializer }, !type !1
+ at vt4b = constant ptr @vf2i32, !type !1
 
-; X86: @__typeid_typeid3_0_12_24_byte = hidden alias i8, inttoptr (i32 -1 to i8*)
-; X86: @__typeid_typeid3_0_12_24_bit = hidden alias i8, inttoptr (i32 1 to i8*)
-; X86: @__typeid_typeid4_0_24_12_byte = hidden alias i8, inttoptr (i32 -4 to i8*)
-; X86: @__typeid_typeid4_0_24_12_bit = hidden alias i8, inttoptr (i32 1 to i8*)
+; X86: @__typeid_typeid3_0_12_24_byte = hidden alias i8, inttoptr (i32 -1 to ptr)
+; X86: @__typeid_typeid3_0_12_24_bit = hidden alias i8, inttoptr (i32 1 to ptr)
+; X86: @__typeid_typeid4_0_24_12_byte = hidden alias i8, inttoptr (i32 -4 to ptr)
+; X86: @__typeid_typeid4_0_24_12_bit = hidden alias i8, inttoptr (i32 1 to ptr)
 ; ARM-NOT: alias {{.*}} inttoptr
 
-; CHECK: @vt3a = alias i1 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }* [[CVT3A]], i32 0, i32 1)
-; CHECK: @vt3b = alias i1 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }* [[CVT3B]], i32 0, i32 1)
-; CHECK: @vt3c = alias i1 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }* [[CVT3C]], i32 0, i32 1)
-; CHECK: @vt3d = alias i1 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i1 (i8*, i32, i32)*, [0 x i8] }* [[CVT3D]], i32 0, i32 1)
-; CHECK: @vt4a = alias i32 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] }* [[CVT4A]], i32 0, i32 1)
-; CHECK: @vt4b = alias i32 (i8*, i32, i32)*, getelementptr inbounds ({ [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] }, { [8 x i8], i32 (i8*, i32, i32)*, [0 x i8] }* [[CVT4B]], i32 0, i32 1)
+; CHECK: @vt3a = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT3A]], i32 0, i32 1)
+; CHECK: @vt3b = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT3B]], i32 0, i32 1)
+; CHECK: @vt3c = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT3C]], i32 0, i32 1)
+; CHECK: @vt3d = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT3D]], i32 0, i32 1)
+; CHECK: @vt4a = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT4A]], i32 0, i32 1)
+; CHECK: @vt4b = alias ptr, getelementptr inbounds ({ [8 x i8], ptr, [0 x i8] }, ptr [[CVT4B]], i32 0, i32 1)
 
-define i1 @vf0i1(i8* %this, i32, i32) readnone {
+define i1 @vf0i1(ptr %this, i32, i32) readnone {
   ret i1 0
 }
 
-define i1 @vf1i1(i8* %this, i32, i32) readnone {
+define i1 @vf1i1(ptr %this, i32, i32) readnone {
   ret i1 1
 }
 
-define i32 @vf1i32(i8* %this, i32, i32) readnone {
+define i32 @vf1i32(ptr %this, i32, i32) readnone {
   ret i32 1
 }
 
-define i32 @vf2i32(i8* %this, i32, i32) readnone {
+define i32 @vf2i32(ptr %this, i32, i32) readnone {
   ret i32 2
 }
 

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll b/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
index 6c5b290f65db9..1d74a59769787 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/import-indir.ll
@@ -68,40 +68,33 @@ target datalayout = "e-p:32:32"
 
 declare void @llvm.assume(i1)
 declare void @llvm.trap()
-declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
-declare i1 @llvm.type.test(i8*, metadata)
+declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 ; CHECK: define i1 @f1
-define i1 @f1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define i1 @f1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i1 %
-  %result = call i1 %fptr_casted(i8* %obj, i32 5)
+  %result = call i1 %fptr(ptr %obj, i32 5)
   ret i1 %result
 }
 
 ; CHECK: define i1 @f2
-define i1 @f2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 4, metadata !"typeid1")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %p = extractvalue {i8*, i1} %pair, 1
+define i1 @f2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 4, metadata !"typeid1")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  %p = extractvalue {ptr, i1} %pair, 1
   ; CHECK: [[P:%.*]] = call i1 @llvm.type.test
   ; CHECK: br i1 [[P]]
   br i1 %p, label %cont, label %trap
 
 cont:
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
   ; CHECK: call i1 %
-  %result = call i1 %fptr_casted(i8* %obj, i32 undef)
+  %result = call i1 %fptr(ptr %obj, i32 undef)
   ret i1 %result
 
 trap:

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/import-no-dominating-assume.ll b/llvm/test/Transforms/WholeProgramDevirt/import-no-dominating-assume.ll
deleted file mode 100644
index 36e8bc7ef706a..0000000000000
--- a/llvm/test/Transforms/WholeProgramDevirt/import-no-dominating-assume.ll
+++ /dev/null
@@ -1,37 +0,0 @@
-; RUN: opt -S -passes=wholeprogramdevirt -wholeprogramdevirt-summary-action=import -wholeprogramdevirt-read-summary=%S/Inputs/import-vcp.yaml < %s | FileCheck %s
-
-target datalayout = "e-p:64:64"
-target triple = "x86_64-unknown-linux-gnu"
-
-define i32 @call1(i1 %a, i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  br i1 %a, label %bb1, label %bb2
-
-bb1:
-  ; CHECK: {{.*}} = bitcast {{.*}} to i8*
-  %vtablei8_1 = bitcast [3 x i8*]* %vtable to i8*
-  %p1 = call i1 @llvm.type.test(i8* %vtablei8_1, metadata !"typeid1")
-  call void @llvm.assume(i1 %p1)
-  %fptrptr1 = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
-  %fptr1 = load i8*, i8** %fptrptr1
-  %fptr1_casted = bitcast i8* %fptr1 to i32 (i8*, i32)*
-  ; CHECK: {{.*}} = bitcast {{.*}} to i8*
-  %result1 = call i32 %fptr1_casted(i8* %obj, i32 1)
-  br label %bb2
-
-  ; CHECK: :
-bb2:
-  %vtablei8_2 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8_2, metadata !"typeid1")
-  call void @llvm.assume(i1 %p)
-  %fptrptr2 = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
-  %fptr2 = load i8*, i8** %fptrptr2
-  %fptr2_casted = bitcast i8* %fptr2 to i32 (i8*, i32)*
-  ; CHECK: {{.*}} = bitcast {{.*}} to i8*
-  %result2 = call i32 %fptr2_casted(i8* %obj, i32 1)
-  ret i32 %result2
-}
-
-declare void @llvm.assume(i1)
-declare i1 @llvm.type.test(i8*, metadata)

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/import.ll b/llvm/test/Transforms/WholeProgramDevirt/import.ll
index 14ee188c820b5..4e4df5f35a777 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/import.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/import.ll
@@ -20,27 +20,19 @@ target triple = "x86_64-unknown-linux-gnu"
 ; constant propagation.
 
 ; CHECK: define i32 @call1
-define i32 @call1(i8* %obj) #0 {
-  %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 !"typeid1")
+define i32 @call1(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   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 i32 (i8*, i32)*
-  ; CHECK: {{.*}} = bitcast {{.*}} to i8*
-  ; VCP: [[VT1:%.*]] = bitcast {{.*}} to i8*
-  ; SINGLE-IMPL: call i32 bitcast (void ()* @singleimpl1 to i32 (i8*, i32)*)
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  ; SINGLE-IMPL: call i32 @singleimpl1
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ; UNIFORM-RET-VAL: ret i32 42
-  ; VCP-X86: [[GEP1:%.*]] = getelementptr i8, i8* [[VT1]], i32 ptrtoint ([0 x i8]* @__typeid_typeid1_0_1_byte to i32)
-  ; VCP-ARM: [[GEP1:%.*]] = getelementptr i8, i8* [[VT1]], i32 42
-  ; VCP: [[BC1:%.*]] = bitcast i8* [[GEP1]] to i32*
-  ; VCP: [[LOAD1:%.*]] = load i32, i32* [[BC1]]
+  ; VCP-X86: [[GEP1:%.*]] = getelementptr i8, ptr %vtable, i32 ptrtoint (ptr @__typeid_typeid1_0_1_byte to i32)
+  ; VCP-ARM: [[GEP1:%.*]] = getelementptr i8, ptr %vtable, i32 42
+  ; VCP: [[LOAD1:%.*]] = load i32, ptr [[GEP1]]
   ; VCP: ret i32 [[LOAD1]]
-  ; BRANCH-FUNNEL-NOVCP: [[VT1:%.*]] = bitcast {{.*}} to i8*
-  ; BRANCH-FUNNEL-NOVCP: call i32 bitcast (void ()* @__typeid_typeid1_0_branch_funnel to i32 (i8*, i8*, i32)*)(i8* nest [[VT1]], i8* %obj, i32 1)
+  ; BRANCH-FUNNEL-NOVCP: call i32 @__typeid_typeid1_0_branch_funnel(ptr nest %vtable, ptr %obj, i32 1)
   ret i32 %result
 }
 
@@ -48,23 +40,19 @@ define i32 @call1(i8* %obj) #0 {
 ; constant propagation.
 
 ; CHECK: define i1 @call2
-define i1 @call2(i8* %obj) #0 {
-  ; BRANCH-FUNNEL: [[VT1:%.*]] = bitcast {{.*}} to i8*
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 8, metadata !"typeid2")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %p = extractvalue {i8*, i1} %pair, 1
+define i1 @call2(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 8, metadata !"typeid2")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  %p = extractvalue {ptr, i1} %pair, 1
   ; SINGLE-IMPL: br i1 true,
   br i1 %p, label %cont, label %trap
 
 cont:
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
-  ; SINGLE-IMPL: call i1 bitcast (void ()* @singleimpl2 to i1 (i8*, i32)*)
+  ; SINGLE-IMPL: call i1 @singleimpl2
   ; INDIR: call i1 %
-  ; BRANCH-FUNNEL: call i1 bitcast (void ()* @__typeid_typeid2_8_branch_funnel to i1 (i8*, i8*, i32)*)(i8* nest [[VT1]], i8* %obj, i32 undef)
-  %result = call i1 %fptr_casted(i8* %obj, i32 undef)
+  ; BRANCH-FUNNEL: call i1 @__typeid_typeid2_8_branch_funnel(ptr nest %vtable, ptr %obj, i32 undef)
+  %result = call i1 %fptr(ptr %obj, i32 undef)
   ret i1 %result
 
 trap:
@@ -73,30 +61,25 @@ trap:
 }
 
 ; CHECK: define i1 @call3
-define i1 @call3(i8* %obj) #0 {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 8, metadata !"typeid2")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %p = extractvalue {i8*, i1} %pair, 1
+define i1 @call3(ptr %obj) #0 {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 8, metadata !"typeid2")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  %p = extractvalue {ptr, i1} %pair, 1
   br i1 %p, label %cont, label %trap
 
 cont:
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*, i32)*
-  %result = call i1 %fptr_casted(i8* %obj, i32 3)
-  ; UNIQUE-RET-VAL0: icmp ne i8* %vtablei8, getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_typeid2_8_3_unique_member, i32 0, i32 0)
-  ; UNIQUE-RET-VAL1: icmp eq i8* %vtablei8, getelementptr inbounds ([0 x i8], [0 x i8]* @__typeid_typeid2_8_3_unique_member, i32 0, i32 0)
-  ; VCP: [[VT2:%.*]] = bitcast {{.*}} to i8*
-  ; VCP-X86: [[GEP2:%.*]] = getelementptr i8, i8* [[VT2]], i32 ptrtoint ([0 x i8]* @__typeid_typeid2_8_3_byte to i32)
-  ; VCP-ARM: [[GEP2:%.*]] = getelementptr i8, i8* [[VT2]], i32 43
-  ; VCP: [[LOAD2:%.*]] = load i8, i8* [[GEP2]]
-  ; VCP-X86: [[AND2:%.*]] = and i8 [[LOAD2]], ptrtoint ([0 x i8]* @__typeid_typeid2_8_3_bit to i8)
+  %result = call i1 %fptr(ptr %obj, i32 3)
+  ; UNIQUE-RET-VAL0: icmp ne ptr %vtable, @__typeid_typeid2_8_3_unique_member
+  ; UNIQUE-RET-VAL1: icmp eq ptr %vtable, @__typeid_typeid2_8_3_unique_member
+  ; VCP-X86: [[GEP2:%.*]] = getelementptr i8, ptr %vtable, i32 ptrtoint (ptr @__typeid_typeid2_8_3_byte to i32)
+  ; VCP-ARM: [[GEP2:%.*]] = getelementptr i8, ptr %vtable, i32 43
+  ; VCP: [[LOAD2:%.*]] = load i8, ptr [[GEP2]]
+  ; VCP-X86: [[AND2:%.*]] = and i8 [[LOAD2]], ptrtoint (ptr @__typeid_typeid2_8_3_bit to i8)
   ; VCP-ARM: [[AND2:%.*]] = and i8 [[LOAD2]], -128
   ; VCP: [[ICMP2:%.*]] = icmp ne i8 [[AND2]], 0
   ; VCP: ret i1 [[ICMP2]]
-  ; BRANCH-FUNNEL-NOVCP: [[VT2:%.*]] = bitcast {{.*}} to i8*
-  ; BRANCH-FUNNEL-NOVCP: call i1 bitcast (void ()* @__typeid_typeid2_8_branch_funnel to i1 (i8*, i8*, i32)*)(i8* nest [[VT2]], i8* %obj, i32 3)
+  ; BRANCH-FUNNEL-NOVCP: call i1 @__typeid_typeid2_8_branch_funnel(ptr nest %vtable, ptr %obj, i32 3)
   ret i1 %result
 
 trap:
@@ -115,7 +98,7 @@ trap:
 
 declare void @llvm.assume(i1)
 declare void @llvm.trap()
-declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
-declare i1 @llvm.type.test(i8*, metadata)
+declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 attributes #0 = { "target-features"="+retpoline" }

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
index 63279da2b6a7f..ed4a67b9389bc 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/non-constant-vtable.ll
@@ -5,28 +5,24 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt = global [1 x i8*] [i8* bitcast (void (i8*)* @vf to i8*)], !type !0
+ at vt = global [1 x ptr] [ptr @vf], !type !0
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
index 0ca6a48fec258..3c5d9b839bc4d 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/pointer-vtable.ll
@@ -3,28 +3,24 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt = constant i8* bitcast (void (i8*)* @vf to i8*), !type !0
+ at vt = constant ptr @vf, !type !0
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
index 6e9917154caa6..c3c18e9fb2ca8 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/soa-vtable.ll
@@ -3,49 +3,41 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-%vtTy = type { [2 x void (i8*)*], [2 x void (i8*)*] }
+%vtTy = type { [2 x ptr], [2 x ptr] }
 
- at vt = constant %vtTy { [2 x void (i8*)*] [void (i8*)* null, void (i8*)* @vf1], [2 x void (i8*)*] [void (i8*)* null, void (i8*)* @vf2] }, !type !0, !type !1
+ at vt = constant %vtTy { [2 x ptr] [ptr null, ptr @vf1], [2 x ptr] [ptr null, ptr @vf2] }, !type !0, !type !1
 
-define void @vf1(i8* %this) {
+define void @vf1(ptr %this) {
   ret void
 }
 
-define void @vf2(i8* %this) {
+define void @vf2(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call1
-define void @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define void @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf1(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @call2
-define void @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define void @call2(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 [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf2(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 8, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
index c1d4915e70866..dd4887eaf96e7 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/struct-vtable.ll
@@ -3,61 +3,50 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-%vtTy = type { void (i8*)* }
+%vtTy = type { ptr }
 
- at vt = constant %vtTy { void (i8*)* @vf }, !type !0
+ at vt = constant %vtTy { ptr @vf }, !type !0
 
-define void @vf(i8* %this) {
+define void @vf(ptr %this) {
   ret void
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call void @vf(
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @call_oob
-define void @call_oob(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call_oob(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 4
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptrptr = getelementptr [1 x ptr], ptr %vtable, i32 0, i32 4
+  %fptr = load ptr, ptr %fptrptr
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
 ; CHECK: define void @call_unaligned
-define void @call_unaligned(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call_unaligned(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr i8, i8* %vtablei8, i32 1
-  %fptrptr_casted = bitcast i8* %fptrptr to i8**
-  %fptr = load i8*, i8** %fptrptr_casted
-  %fptr_casted = bitcast i8* %fptr to void (i8*)*
+  %fptrptr = getelementptr i8, ptr %vtable, i32 1
+  %fptr = load ptr, ptr %fptrptr
   ; CHECK: call void %
-  call void %fptr_casted(i8* %obj)
+  call void %fptr(ptr %obj)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
index c15efd79b6956..88d539294777e 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-invoke.ll
@@ -3,29 +3,25 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this) readnone {
+define i32 @vf1(ptr %this) readnone {
   ret i32 123
 }
 
-define i32 @vf2(i8* %this) readnone {
+define i32 @vf2(ptr %this) readnone {
   ret i32 123
 }
 
 ; CHECK: define i32 @call
-define i32 @call(i8* %obj) personality i8* undef {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call(ptr %obj) personality ptr undef {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: br label %[[RET:[0-9A-Za-z]*]]
-  %result = invoke i32 %fptr_casted(i8* %obj) to label %ret unwind label %unwind
+  %result = invoke i32 %fptr(ptr %obj) to label %ret unwind label %unwind
 
 unwind:
   %x = landingpad i32 cleanup
@@ -37,7 +33,7 @@ ret:
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-multiple-assumes.ll b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-multiple-assumes.ll
index 0ad2f94aa5823..f15ad6071304f 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-multiple-assumes.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval-multiple-assumes.ll
@@ -3,36 +3,32 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this) readnone {
+define i32 @vf1(ptr %this) readnone {
   ret i32 123
 }
 
-define i32 @vf2(i8* %this) readnone {
+define i32 @vf2(ptr %this) readnone {
   ret i32 123
 }
 
 ; CHECK: define i32 @call
-define i32 @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %p2 = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+  %p2 = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p2)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  %result = call i32 %fptr_casted(i8* %obj)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK-NOT: call i32 %
   ; CHECK: ret i32 123
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
index 0661e4af482ff..8709a6fc31393 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/uniform-retval.ll
@@ -10,34 +10,30 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: remark: {{.*}} devirtualized vf1
 ; CHECK: remark: {{.*}} devirtualized vf2
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this) readnone {
+define i32 @vf1(ptr %this) readnone {
   ret i32 123
 }
 
-define i32 @vf2(i8* %this) readnone {
+define i32 @vf2(ptr %this) readnone {
   ret i32 123
 }
 
 ; CHECK: define i32 @call
-define i32 @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  %result = call i32 %fptr_casted(i8* %obj)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK-NOT: call i32 %
   ; CHECK: ret i32 123
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/unique-retval-multiple-assumes.ll b/llvm/test/Transforms/WholeProgramDevirt/unique-retval-multiple-assumes.ll
index ba13a7004edcf..7af76f3528fca 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/unique-retval-multiple-assumes.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/unique-retval-multiple-assumes.ll
@@ -3,38 +3,34 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf0 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf0 to i8*)], !type !0, !type !1
- at vt3 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf1 to i8*)], !type !0, !type !1
- at vt4 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf1 to i8*)], !type !1
+ at vt1 = constant [1 x ptr] [ptr @vf0], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf0], !type !0, !type !1
+ at vt3 = constant [1 x ptr] [ptr @vf1], !type !0, !type !1
+ at vt4 = constant [1 x ptr] [ptr @vf1], !type !1
 
-define i1 @vf0(i8* %this) readnone {
+define i1 @vf0(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1(i8* %this) readnone {
+define i1 @vf1(ptr %this) readnone {
   ret i1 1
 }
 
 ; CHECK: define i1 @call
-define i1 @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define i1 @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %p2 = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+  %p2 = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p2)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[RES1:%[^ ]*]] = icmp eq [1 x i8*]* %vtable, @vt3
-  %result = call i1 %fptr_casted(i8* %obj)
+  %fptr = load ptr, ptr %vtable
+  ; CHECK: [[RES1:%[^ ]*]] = icmp eq ptr %vtable, @vt3
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[RES1]]
   ret i1 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/unique-retval-same-vtable.ll b/llvm/test/Transforms/WholeProgramDevirt/unique-retval-same-vtable.ll
index f2a6c63e81791..2eaed6ea22155 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/unique-retval-same-vtable.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/unique-retval-same-vtable.ll
@@ -19,33 +19,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-unknown-linux-gnu"
 
-%class.C = type { i32 (...)** }
+%class.C = type { ptr }
 
-define hidden i32 @_ZNK1C1fEv(%class.C* %this) {
+define hidden i32 @_ZNK1C1fEv(ptr %this) {
 entry:
-  %0 = bitcast %class.C* %this to i1 (%class.C*)***
-  %vtable = load i1 (%class.C*)**, i1 (%class.C*)*** %0
-  %1 = bitcast i1 (%class.C*)** %vtable to i8*
-  %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1C")
-  tail call void @llvm.assume(i1 %2)
-  %vfn = getelementptr inbounds i1 (%class.C*)*, i1 (%class.C*)** %vtable, i64 2
-  %3 = load i1 (%class.C*)*, i1 (%class.C*)** %vfn
-  %call = tail call zeroext i1 %3(%class.C* %this)
+  %vtable = load ptr, ptr %this
+  %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1C")
+  tail call void @llvm.assume(i1 %0)
+  %vfn = getelementptr inbounds ptr, ptr %vtable, i64 2
+  %1 = load ptr, ptr %vfn
+  %call = tail call zeroext i1 %1(ptr %this)
   br i1 %call, label %if.then, label %return
 
 if.then:
-  %vtable2 = load i1 (%class.C*)**, i1 (%class.C*)*** %0
-  %4 = bitcast i1 (%class.C*)** %vtable2 to i8*
-  %5 = tail call i1 @llvm.type.test(i8* %4, metadata !"_ZTS1C")
-  tail call void @llvm.assume(i1 %5)
-  %vfn3 = getelementptr inbounds i1 (%class.C*)*, i1 (%class.C*)** %vtable2, i64 3
-  %6 = load i1 (%class.C*)*, i1 (%class.C*)** %vfn3
+  %vtable2 = load ptr, ptr %this
+  %2 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1C")
+  tail call void @llvm.assume(i1 %2)
+  %vfn3 = getelementptr inbounds ptr, ptr %vtable2, i64 3
+  %3 = load ptr, ptr %vfn3
   ; The method being called here and the method being called before
   ; the branch above both return true in the same vtable and only that
   ; vtable. Therefore, if this call is reached, we must select
   ; 20074028. Earlier versions of LLVM mistakenly concluded that
   ; this code *never* selects 200744028.
-  %call4 = tail call zeroext i1 %6(%class.C* nonnull %this)
+  %call4 = tail call zeroext i1 %3(ptr nonnull %this)
   %. = select i1 %call4, i32 20074028, i32 3007762
   br label %return
 
@@ -54,6 +51,6 @@ return:
   ret i32 %retval.0
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 
 declare void @llvm.assume(i1)

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll b/llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
index f2c089f326c68..4758489c5669b 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/unique-retval.ll
@@ -11,54 +11,46 @@ target triple = "x86_64-unknown-linux-gnu"
 ; CHECK: remark: {{.*}} devirtualized vf0
 ; CHECK: remark: {{.*}} devirtualized vf1
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf0 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf0 to i8*)], !type !0, !type !1
- at vt3 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf1 to i8*)], !type !0, !type !1
- at vt4 = constant [1 x i8*] [i8* bitcast (i1 (i8*)* @vf1 to i8*)], !type !1
+ at vt1 = constant [1 x ptr] [ptr @vf0], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf0], !type !0, !type !1
+ at vt3 = constant [1 x ptr] [ptr @vf1], !type !0, !type !1
+ at vt4 = constant [1 x ptr] [ptr @vf1], !type !1
 
-define i1 @vf0(i8* %this) readnone {
+define i1 @vf0(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1(i8* %this) readnone {
+define i1 @vf1(ptr %this) readnone {
   ret i1 1
 }
 
 ; CHECK: define i1 @call1
-define i1 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[RES1:%[^ ]*]] = icmp eq [1 x i8*]* %vtable, @vt3
-  %result = call i1 %fptr_casted(i8* %obj)
+  %fptr = load ptr, ptr %vtable
+  ; CHECK: [[RES1:%[^ ]*]] = icmp eq ptr %vtable, @vt3
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[RES1]]
   ret i1 %result
 }
 
 ; CHECK: define i32 @call2
-define i32 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i32 @call2(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 [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
+  %fptr = load ptr, ptr %vtable
   ; Intentional type mismatch to test zero extend.
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  ; CHECK: [[RES2:%[^ ]*]] = icmp ne [1 x i8*]* %vtable, @vt2
-  %result = call i32 %fptr_casted(i8* %obj)
+  ; CHECK: [[RES2:%[^ ]*]] = icmp ne ptr %vtable, @vt2
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK: [[ZEXT2:%[^ ]*]] = zext i1 [[RES2]] to i32
   ; CHECK: ret i32 [[ZEXT2:%[^ ]*]]
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
index 66843da435a89..794bbfa152871 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-accesses-memory.ll
@@ -3,26 +3,26 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [2 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1a to i8*), i8* bitcast (i32 (i8*, i32)* @vf1b to i8*)], !type !0
- at vt2 = constant [2 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2a to i8*), i8* bitcast (i32 (i8*, i32)* @vf2b to i8*)], !type !0
+ at vt1 = constant [2 x ptr] [ptr @vf1a, ptr @vf1b], !type !0
+ at vt2 = constant [2 x ptr] [ptr @vf2a, ptr @vf2b], !type !0
 
 @sink = external global i32
 
-define i32 @vf1a(i8* %this, i32 %arg) {
-  store i32 %arg, i32* @sink
+define i32 @vf1a(ptr %this, i32 %arg) {
+  store i32 %arg, ptr @sink
   ret i32 %arg
 }
 
-define i32 @vf2a(i8* %this, i32 %arg) {
-  store i32 %arg, i32* @sink
+define i32 @vf2a(ptr %this, i32 %arg) {
+  store i32 %arg, ptr @sink
   ret i32 %arg
 }
 
-define i32 @vf1b(i8* %this, i32 %arg) {
+define i32 @vf1b(ptr %this, i32 %arg) {
   ret i32 %arg
 }
 
-define i32 @vf2b(i8* %this, i32 %arg) {
+define i32 @vf2b(ptr %this, i32 %arg) {
   ret i32 %arg
 }
 
@@ -30,17 +30,13 @@ define i32 @vf2b(i8* %this, i32 %arg) {
 ; even if the function returns a constant.
 
 ; CHECK: define i32 @call1
-define i32 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
 
@@ -48,21 +44,18 @@ define i32 @call1(i8* %obj) {
 ; the function body itself.
 
 ; CHECK: define i32 @call2
-define i32 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 1
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %fptrptr = getelementptr [1 x ptr], ptr %vtable, i32 0, i32 1
+  %fptr = load ptr, ptr %fptrptr
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ; CHECK: ret i32 1
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
index a68173fc8f75b..783e67d73d72e 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-decl.ll
@@ -3,30 +3,26 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-declare i32 @vf1(i8* %this, i32 %arg) readnone
+declare i32 @vf1(ptr %this, i32 %arg) readnone
 
-define i32 @vf2(i8* %this, i32 %arg) readnone {
+define i32 @vf2(ptr %this, i32 %arg) readnone {
   ret i32 %arg
 }
 
 ; CHECK: define i32 @fn
-define i32 @fn(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @fn(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i32 1)
+  %result = call i32 %fptr(ptr %obj, i32 1)
   ret i32 %result
 }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
index d7f2c30090a9f..4688e654c5a6f 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-no-this.ll
@@ -3,8 +3,8 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 ()* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 ()* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
 define i32 @vf1() readnone {
   ret i32 1
@@ -15,21 +15,17 @@ define i32 @vf2() readnone {
 }
 
 ; CHECK: define i32 @call
-define i32 @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 ()*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted()
+  %result = call i32 %fptr()
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
index c66c31b28e563..d70fb98525def 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-non-constant-arg.ll
@@ -3,33 +3,29 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this, i32 %arg) readnone {
+define i32 @vf1(ptr %this, i32 %arg) readnone {
   ret i32 %arg
 }
 
-define i32 @vf2(i8* %this, i32 %arg) readnone {
+define i32 @vf2(ptr %this, i32 %arg) readnone {
   ret i32 %arg
 }
 
 ; CHECK: define void @call
-define void @call(i8* %obj, i32 %arg) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define void @call(ptr %obj, i32 %arg) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i32)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i32 %arg)
+  %result = call i32 %fptr(ptr %obj, i32 %arg)
   ret void
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
index ae416d25e7c79..959ed008e3bf1 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-too-wide-ints.ll
@@ -3,62 +3,54 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i64 (i8*, i128)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i64 (i8*, i128)* @vf2 to i8*)], !type !0
- at vt3 = constant [1 x i8*] [i8* bitcast (i128 (i8*, i64)* @vf3 to i8*)], !type !1
- at vt4 = constant [1 x i8*] [i8* bitcast (i128 (i8*, i64)* @vf4 to i8*)], !type !1
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
+ at vt3 = constant [1 x ptr] [ptr @vf3], !type !1
+ at vt4 = constant [1 x ptr] [ptr @vf4], !type !1
 
-define i64 @vf1(i8* %this, i128 %arg) readnone {
+define i64 @vf1(ptr %this, i128 %arg) readnone {
   %argtrunc = trunc i128 %arg to i64
   ret i64 %argtrunc
 }
 
-define i64 @vf2(i8* %this, i128 %arg) readnone {
+define i64 @vf2(ptr %this, i128 %arg) readnone {
   %argtrunc = trunc i128 %arg to i64
   ret i64 %argtrunc
 }
 
-define i128 @vf3(i8* %this, i64 %arg) readnone {
+define i128 @vf3(ptr %this, i64 %arg) readnone {
   %argzext = zext i64 %arg to i128
   ret i128 %argzext
 }
 
-define i128 @vf4(i8* %this, i64 %arg) readnone {
+define i128 @vf4(ptr %this, i64 %arg) readnone {
   %argzext = zext i64 %arg to i128
   ret i128 %argzext
 }
 
 ; CHECK: define i64 @call1
-define i64 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid1")
+define i64 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid1")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i64 (i8*, i128)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i64 %
-  %result = call i64 %fptr_casted(i8* %obj, i128 1)
+  %result = call i64 %fptr(ptr %obj, i128 1)
   ret i64 %result
 }
 
 ; CHECK: define i128 @call2
-define i128 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i128 @call2(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 [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i128 (i8*, i64)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i128 %
-  %result = call i128 %fptr_casted(i8* %obj, i64 1)
+  %result = call i128 %fptr(ptr %obj, i64 1)
   ret i128 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid1"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
index 54b861c4e9f8e..0a1bff28155d8 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-type-mismatch.ll
@@ -9,63 +9,51 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*, i32)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this, i32 %arg) readnone {
+define i32 @vf1(ptr %this, i32 %arg) readnone {
   ret i32 %arg
 }
 
-define i32 @vf2(i8* %this, i32 %arg) readnone {
+define i32 @vf2(ptr %this, i32 %arg) readnone {
   ret i32 %arg
 }
 
 ; CHECK: define i32 @bad_arg_type
-define i32 @bad_arg_type(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @bad_arg_type(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i64)*
-  %result = call i32 %fptr_casted(i8* %obj, i64 1)
+  %fptr = load ptr, ptr %vtable
+  %result = call i32 %fptr(ptr %obj, i64 1)
   ; CHECK: ret i32 1
   ret i32 %result
 }
 
 ; CHECK: define i32 @bad_arg_count
-define i32 @bad_arg_count(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @bad_arg_count(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*, i64, i64)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj, i64 1, i64 2)
+  %result = call i32 %fptr(ptr %obj, i64 1, i64 2)
   ret i32 %result
 }
 
 ; CHECK: define i64 @bad_return_type
-define i64 @bad_return_type(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i64 @bad_return_type(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i64 (i8*, i32)*
-  %result = call i64 %fptr_casted(i8* %obj, i32 1)
+  %fptr = load ptr, ptr %vtable
+  %result = call i64 %fptr(ptr %obj, i32 1)
   ; CHECK: ret i64 1
   ret i64 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll b/llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
index 14b7a325c2c7e..793f8772511bb 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vcp-uses-this.ll
@@ -3,35 +3,31 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt1 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf1 to i8*)], !type !0
- at vt2 = constant [1 x i8*] [i8* bitcast (i32 (i8*)* @vf2 to i8*)], !type !0
+ at vt1 = constant [1 x ptr] [ptr @vf1], !type !0
+ at vt2 = constant [1 x ptr] [ptr @vf2], !type !0
 
-define i32 @vf1(i8* %this) readnone {
-  %this_int = ptrtoint i8* %this to i32
+define i32 @vf1(ptr %this) readnone {
+  %this_int = ptrtoint ptr %this to i32
   ret i32 %this_int
 }
 
-define i32 @vf2(i8* %this) readnone {
-  %this_int = ptrtoint i8* %this to i32
+define i32 @vf2(ptr %this) readnone {
+  %this_int = ptrtoint ptr %this to i32
   ret i32 %this_int
 }
 
 ; CHECK: define i32 @call
-define i32 @call(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [1 x i8*]**
-  %vtable = load [1 x i8*]*, [1 x i8*]** %vtableptr
-  %vtablei8 = bitcast [1 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [1 x i8*], [1 x i8*]* %vtable, i32 0, i32 0
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
+  %fptr = load ptr, ptr %vtable
   ; CHECK: call i32 %
-  %result = call i32 %fptr_casted(i8* %obj)
+  %result = call i32 %fptr(ptr %obj)
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 !0 = !{i32 0, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
index cac1d9923db68..11273804e2081 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-begin.ll
@@ -3,133 +3,116 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\01\00\00\00\02", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf1i32 to i8*)], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
- at vt1 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf1i32 to i8*)
+; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\01\00\00\00\02", [3 x ptr] [ptr @vf0i1, ptr @vf1i1, ptr @vf1i32], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
+ at vt1 = constant [3 x ptr] [
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf1i32
 ], section "vt1sec", !type !0
 
-; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\02\00\00\00\01", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf2i32 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
- at vt2 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf2i32 to i8*)
+; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\02\00\00\00\01", [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf2i32], [0 x i8] zeroinitializer }, !type [[T8]]
+ at vt2 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf2i32
 ], !type !0
 
-; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [5 x i8], [3 x i8*], [0 x i8] } { [5 x i8] c"\03\00\00\00\02", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf3i32 to i8*)], [0 x i8] zeroinitializer }, align 1, !type [[T5:![0-9]+]]
- at vt3 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf3i32 to i8*)
+; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [5 x i8], [3 x ptr], [0 x i8] } { [5 x i8] c"\03\00\00\00\02", [3 x ptr] [ptr @vf0i1, ptr @vf1i1, ptr @vf3i32], [0 x i8] zeroinitializer }, align 1, !type [[T5:![0-9]+]]
+ at vt3 = constant [3 x ptr] [
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf3i32
 ], align 1, !type !0
 
-; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [16 x i8], [3 x i8*], [0 x i8] } { [16 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\01", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf4i32 to i8*)], [0 x i8] zeroinitializer },  align 16, !type [[T16:![0-9]+]]
- at vt4 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf4i32 to i8*)
+; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [16 x i8], [3 x ptr], [0 x i8] } { [16 x i8] c"\00\00\00\00\00\00\00\00\00\00\00\04\00\00\00\01", [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf4i32], [0 x i8] zeroinitializer },  align 16, !type [[T16:![0-9]+]]
+ at vt4 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf4i32
 ], align 16, !type !0
 
 ; CHECK: @vt5 = {{.*}}, !type [[T0:![0-9]+]]
- at vt5 = constant [3 x i8*] [
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*),
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*),
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*)
+ at vt5 = constant [3 x ptr] [
+ptr @__cxa_pure_virtual,
+ptr @__cxa_pure_virtual,
+ptr @__cxa_pure_virtual
 ], !type !0
 
-; CHECK: @vt1 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT1DATA]], i32 0, i32 1)
-; CHECK: @vt2 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT2DATA]], i32 0, i32 1)
-; CHECK: @vt3 = alias [3 x i8*], getelementptr inbounds ({ [5 x i8], [3 x i8*], [0 x i8] }, { [5 x i8], [3 x i8*], [0 x i8] }* [[VT3DATA]], i32 0, i32 1)
-; CHECK: @vt4 = alias [3 x i8*], getelementptr inbounds ({ [16 x i8], [3 x i8*], [0 x i8] }, { [16 x i8], [3 x i8*], [0 x i8] }* [[VT4DATA]], i32 0, i32 1)
+; CHECK: @vt1 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT1DATA]], i32 0, i32 1)
+; CHECK: @vt2 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT2DATA]], i32 0, i32 1)
+; CHECK: @vt3 = alias [3 x ptr], getelementptr inbounds ({ [5 x i8], [3 x ptr], [0 x i8] }, ptr [[VT3DATA]], i32 0, i32 1)
+; CHECK: @vt4 = alias [3 x ptr], getelementptr inbounds ({ [16 x i8], [3 x ptr], [0 x i8] }, ptr [[VT4DATA]], i32 0, i32 1)
 
-define i1 @vf0i1(i8* %this) readnone {
+define i1 @vf0i1(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1i1(i8* %this) readnone {
+define i1 @vf1i1(ptr %this) readnone {
   ret i1 1
 }
 
-define i32 @vf1i32(i8* %this) readnone {
+define i32 @vf1i32(ptr %this) readnone {
   ret i32 1
 }
 
-define i32 @vf2i32(i8* %this) readnone {
+define i32 @vf2i32(ptr %this) readnone {
   ret i32 2
 }
 
-define i32 @vf3i32(i8* %this) readnone {
+define i32 @vf3i32(ptr %this) readnone {
   ret i32 3
 }
 
-define i32 @vf4i32(i8* %this) readnone {
+define i32 @vf4i32(ptr %this) readnone {
   ret i32 4
 }
 
 ; CHECK: define i1 @call1(
-define i1 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT1:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   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*)*
-  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, i8* [[VT1]], i32 -1
-  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, i8* [[VTGEP1]]
+  %fptr = load ptr, ptr %vtable
+  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -1
+  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, ptr [[VTGEP1]]
   ; CHECK: [[VTAND1:%[^ ]*]] = and i8 [[VTLOAD1]], 1
   ; CHECK: [[VTCMP1:%[^ ]*]] = icmp ne i8 [[VTAND1]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[VTCMP1]]
   ret i1 %result
 }
 
 ; CHECK: define i1 @call2(
-define i1 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT2:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 1
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, i8* [[VT2]], i32 -1
-  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, i8* [[VTGEP2]]
+  %fptrptr = getelementptr [3 x ptr], ptr %vtable, i32 0, i32 1
+  %fptr = load ptr, ptr %fptrptr
+  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -1
+  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, ptr [[VTGEP2]]
   ; CHECK: [[VTAND2:%[^ ]*]] = and i8 [[VTLOAD2]], 2
   ; CHECK: [[VTCMP2:%[^ ]*]] = icmp ne i8 [[VTAND2]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[VTCMP2]]
   ret i1 %result
 }
 
 ; CHECK: define i32 @call3(
-define i32 @call3(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT3:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call3(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 2
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, i8* [[VT3]], i32 -5
-  ; CHECK: [[VTBC3:%[^ ]*]] = bitcast i8* [[VTGEP3]] to i32*
-  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, i32* [[VTBC3]]
-  %result = call i32 %fptr_casted(i8* %obj)
+  %fptrptr = getelementptr [3 x ptr], ptr %vtable, i32 0, i32 2
+  %fptr = load ptr, ptr %fptrptr
+  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -5
+  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, ptr [[VTGEP3]]
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK: ret i32 [[VTLOAD3]]
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 declare void @__cxa_pure_virtual()
 

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
index 77a7cd9b515c0..fb8b6de003fdd 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-check.ll
@@ -34,130 +34,117 @@ target triple = "x86_64-unknown-linux-gnu"
 
 ; SKIP-ALL-NOT: devirtualized
 
-; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\01\00\00\00\02", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf1i32 to i8*)], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
- at vt1 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf1i32 to i8*)
+; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\01\00\00\00\02", [3 x ptr] [ptr @vf0i1, ptr @vf1i1, ptr @vf1i32], [0 x i8] zeroinitializer }, section "vt1sec", !type [[T8:![0-9]+]]
+ at vt1 = constant [3 x ptr] [
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf1i32
 ], section "vt1sec", !type !0
 
-; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\02\00\00\00\01", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf2i32 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
- at vt2 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf2i32 to i8*)
+; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\02\00\00\00\01", [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf2i32], [0 x i8] zeroinitializer }, !type [[T8]]
+ at vt2 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf2i32
 ], !type !0
 
-; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\03\00\00\00\02", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf3i32 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
- at vt3 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf3i32 to i8*)
+; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\03\00\00\00\02", [3 x ptr] [ptr @vf0i1, ptr @vf1i1, ptr @vf3i32], [0 x i8] zeroinitializer }, !type [[T8]]
+ at vt3 = constant [3 x ptr] [
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf3i32
 ], !type !0
 
-; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [8 x i8], [3 x i8*], [0 x i8] } { [8 x i8] c"\00\00\00\04\00\00\00\01", [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf4i32 to i8*)], [0 x i8] zeroinitializer }, !type [[T8]]
- at vt4 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf4i32 to i8*)
+; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [8 x i8], [3 x ptr], [0 x i8] } { [8 x i8] c"\00\00\00\04\00\00\00\01", [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf4i32], [0 x i8] zeroinitializer }, !type [[T8]]
+ at vt4 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf4i32
 ], !type !0
 
 ; CHECK: @vt5 = {{.*}}, !type [[T0:![0-9]+]]
- at vt5 = constant [3 x i8*] [
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*),
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*),
-i8* bitcast (void ()* @__cxa_pure_virtual to i8*)
+ at vt5 = constant [3 x ptr] [
+ptr @__cxa_pure_virtual,
+ptr @__cxa_pure_virtual,
+ptr @__cxa_pure_virtual
 ], !type !0
 
-; CHECK: @vt1 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT1DATA]], i32 0, i32 1)
-; CHECK: @vt2 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT2DATA]], i32 0, i32 1)
-; CHECK: @vt3 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT3DATA]], i32 0, i32 1)
-; CHECK: @vt4 = alias [3 x i8*], getelementptr inbounds ({ [8 x i8], [3 x i8*], [0 x i8] }, { [8 x i8], [3 x i8*], [0 x i8] }* [[VT4DATA]], i32 0, i32 1)
+; CHECK: @vt1 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT1DATA]], i32 0, i32 1)
+; CHECK: @vt2 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT2DATA]], i32 0, i32 1)
+; CHECK: @vt3 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT3DATA]], i32 0, i32 1)
+; CHECK: @vt4 = alias [3 x ptr], getelementptr inbounds ({ [8 x i8], [3 x ptr], [0 x i8] }, ptr [[VT4DATA]], i32 0, i32 1)
 
-define i1 @vf0i1(i8* %this) readnone {
+define i1 @vf0i1(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1i1(i8* %this) readnone {
+define i1 @vf1i1(ptr %this) readnone {
   ret i1 1
 }
 
-define i32 @vf1i32(i8* %this) readnone {
+define i32 @vf1i32(ptr %this) readnone {
   ret i32 1
 }
 
-define i32 @vf2i32(i8* %this) readnone {
+define i32 @vf2i32(ptr %this) readnone {
   ret i32 2
 }
 
-define i32 @vf3i32(i8* %this) readnone {
+define i32 @vf3i32(ptr %this) readnone {
   ret i32 3
 }
 
-define i32 @vf4i32(i8* %this) readnone {
+define i32 @vf4i32(ptr %this) readnone {
   ret i32 4
 }
 
 ; CHECK: define i1 @call1(
-define i1 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: [[VT1:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 0, metadata !"typeid")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, i8* [[VT1]], i32 -1
-  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, i8* [[VTGEP1]]
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 0, metadata !"typeid")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -1
+  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, ptr [[VTGEP1]]
   ; CHECK: [[VTAND1:%[^ ]*]] = and i8 [[VTLOAD1]], 1
   ; CHECK: [[VTCMP1:%[^ ]*]] = icmp ne i8 [[VTAND1]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: [[AND1:%[^ ]*]] = and i1 [[VTCMP1]], true
-  %p = extractvalue {i8*, i1} %pair, 1
+  %p = extractvalue {ptr, i1} %pair, 1
   %and = and i1 %result, %p
   ; CHECK: ret i1 [[AND1]]
   ret i1 %and
 }
 
 ; CHECK: define i1 @call2(
-define i1 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: [[VT2:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 8, metadata !"typeid")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, i8* [[VT2]], i32 -1
-  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, i8* [[VTGEP2]]
+define i1 @call2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 8, metadata !"typeid")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -1
+  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, ptr [[VTGEP2]]
   ; CHECK: [[VTAND2:%[^ ]*]] = and i8 [[VTLOAD2]], 2
   ; CHECK: [[VTCMP2:%[^ ]*]] = icmp ne i8 [[VTAND2]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: [[AND2:%[^ ]*]] = and i1 [[VTCMP2]], true
-  %p = extractvalue {i8*, i1} %pair, 1
+  %p = extractvalue {ptr, i1} %pair, 1
   %and = and i1 %result, %p
   ; CHECK: ret i1 [[AND2]]
   ret i1 %and
 }
 
 ; CHECK: define i32 @call3(
-define i32 @call3(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: [[VT3:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtablei8, i32 16, metadata !"typeid")
-  %fptr = extractvalue {i8*, i1} %pair, 0
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, i8* [[VT3]], i32 -5
-  ; CHECK: [[VTBC3:%[^ ]*]] = bitcast i8* [[VTGEP3]] to i32*
-  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, i32* [[VTBC3]]
-  %result = call i32 %fptr_casted(i8* %obj)
+define i32 @call3(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %pair = call {ptr, i1} @llvm.type.checked.load(ptr %vtable, i32 16, metadata !"typeid")
+  %fptr = extractvalue {ptr, i1} %pair, 0
+  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 -5
+  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, ptr [[VTGEP3]]
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK: ret i32 [[VTLOAD3]]
   ret i32 %result
 }
 
-declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
+declare {ptr, i1} @llvm.type.checked.load(ptr, i32, metadata)
 declare void @llvm.assume(i1)
 declare void @__cxa_pure_virtual()
 

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
index 819e2149d5c92..a28c27079f8de 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-end.ll
@@ -3,128 +3,111 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
-; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [0 x i8], [4 x i8*], [5 x i8] } { [0 x i8] zeroinitializer, [4 x i8*] [i8* null, i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf1i32 to i8*)], [5 x i8] c"\02\01\00\00\00" }, !type [[T8:![0-9]+]]
- at vt1 = constant [4 x i8*] [
-i8* null,
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf1i32 to i8*)
+; CHECK: [[VT1DATA:@[^ ]*]] = private constant { [0 x i8], [4 x ptr], [5 x i8] } { [0 x i8] zeroinitializer, [4 x ptr] [ptr null, ptr @vf0i1, ptr @vf1i1, ptr @vf1i32], [5 x i8] c"\02\01\00\00\00" }, !type [[T8:![0-9]+]]
+ at vt1 = constant [4 x ptr] [
+ptr null,
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf1i32
 ], !type !1
 
-; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [0 x i8], [3 x i8*], [5 x i8] } { [0 x i8] zeroinitializer, [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf2i32 to i8*)], [5 x i8] c"\01\02\00\00\00" }, !type [[T0:![0-9]+]]
- at vt2 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf2i32 to i8*)
+; CHECK: [[VT2DATA:@[^ ]*]] = private constant { [0 x i8], [3 x ptr], [5 x i8] } { [0 x i8] zeroinitializer, [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf2i32], [5 x i8] c"\01\02\00\00\00" }, !type [[T0:![0-9]+]]
+ at vt2 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf2i32
 ], !type !0
 
-; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [0 x i8], [4 x i8*], [5 x i8] } { [0 x i8] zeroinitializer, [4 x i8*] [i8* null, i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i32 (i8*)* @vf3i32 to i8*)], [5 x i8] c"\02\03\00\00\00" }, !type [[T8]]
- at vt3 = constant [4 x i8*] [
-i8* null,
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf3i32 to i8*)
+; CHECK: [[VT3DATA:@[^ ]*]] = private constant { [0 x i8], [4 x ptr], [5 x i8] } { [0 x i8] zeroinitializer, [4 x ptr] [ptr null, ptr @vf0i1, ptr @vf1i1, ptr @vf3i32], [5 x i8] c"\02\03\00\00\00" }, !type [[T8]]
+ at vt3 = constant [4 x ptr] [
+ptr null,
+ptr @vf0i1,
+ptr @vf1i1,
+ptr @vf3i32
 ], !type !1
 
-; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [0 x i8], [3 x i8*], [5 x i8] } { [0 x i8] zeroinitializer, [3 x i8*] [i8* bitcast (i1 (i8*)* @vf1i1 to i8*), i8* bitcast (i1 (i8*)* @vf0i1 to i8*), i8* bitcast (i32 (i8*)* @vf4i32 to i8*)], [5 x i8] c"\01\04\00\00\00" }, !type [[T0]]
- at vt4 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf4i32 to i8*)
+; CHECK: [[VT4DATA:@[^ ]*]] = private constant { [0 x i8], [3 x ptr], [5 x i8] } { [0 x i8] zeroinitializer, [3 x ptr] [ptr @vf1i1, ptr @vf0i1, ptr @vf4i32], [5 x i8] c"\01\04\00\00\00" }, !type [[T0]]
+ at vt4 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf4i32
 ], !type !0
 
-; CHECK: @vt1 = alias [4 x i8*], getelementptr inbounds ({ [0 x i8], [4 x i8*], [5 x i8] }, { [0 x i8], [4 x i8*], [5 x i8] }* [[VT1DATA]], i32 0, i32 1)
-; CHECK: @vt2 = alias [3 x i8*], getelementptr inbounds ({ [0 x i8], [3 x i8*], [5 x i8] }, { [0 x i8], [3 x i8*], [5 x i8] }* [[VT2DATA]], i32 0, i32 1)
-; CHECK: @vt3 = alias [4 x i8*], getelementptr inbounds ({ [0 x i8], [4 x i8*], [5 x i8] }, { [0 x i8], [4 x i8*], [5 x i8] }* [[VT3DATA]], i32 0, i32 1)
-; CHECK: @vt4 = alias [3 x i8*], getelementptr inbounds ({ [0 x i8], [3 x i8*], [5 x i8] }, { [0 x i8], [3 x i8*], [5 x i8] }* [[VT4DATA]], i32 0, i32 1)
+; CHECK: @vt1 = alias [4 x ptr], getelementptr inbounds ({ [0 x i8], [4 x ptr], [5 x i8] }, ptr [[VT1DATA]], i32 0, i32 1)
+; CHECK: @vt2 = alias [3 x ptr], getelementptr inbounds ({ [0 x i8], [3 x ptr], [5 x i8] }, ptr [[VT2DATA]], i32 0, i32 1)
+; CHECK: @vt3 = alias [4 x ptr], getelementptr inbounds ({ [0 x i8], [4 x ptr], [5 x i8] }, ptr [[VT3DATA]], i32 0, i32 1)
+; CHECK: @vt4 = alias [3 x ptr], getelementptr inbounds ({ [0 x i8], [3 x ptr], [5 x i8] }, ptr [[VT4DATA]], i32 0, i32 1)
 
-define i1 @vf0i1(i8* %this) readnone {
+define i1 @vf0i1(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1i1(i8* %this) readnone {
+define i1 @vf1i1(ptr %this) readnone {
   ret i1 1
 }
 
-define i32 @vf1i32(i8* %this) readnone {
+define i32 @vf1i32(ptr %this) readnone {
   ret i32 1
 }
 
-define i32 @vf2i32(i8* %this) readnone {
+define i32 @vf2i32(ptr %this) readnone {
   ret i32 2
 }
 
-define i32 @vf3i32(i8* %this) readnone {
+define i32 @vf3i32(ptr %this) readnone {
   ret i32 3
 }
 
-define i32 @vf4i32(i8* %this) readnone {
+define i32 @vf4i32(ptr %this) readnone {
   ret i32 4
 }
 
 ; CHECK: define i1 @call1(
-define i1 @call1(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT1:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   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*)*
-  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, i8* [[VT1]], i32 24
-  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, i8* [[VTGEP1]]
+  %fptr = load ptr, ptr %vtable
+  ; CHECK: [[VTGEP1:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 24
+  ; CHECK: [[VTLOAD1:%[^ ]*]] = load i8, ptr [[VTGEP1]]
   ; CHECK: [[VTAND1:%[^ ]*]] = and i8 [[VTLOAD1]], 1
   ; CHECK: [[VTCMP1:%[^ ]*]] = icmp ne i8 [[VTAND1]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[VTCMP1]]
   ret i1 %result
 }
 
 ; CHECK: define i1 @call2(
-define i1 @call2(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT2:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i1 @call2(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 1
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
-  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, i8* [[VT2]], i32 24
-  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, i8* [[VTGEP2]]
+  %fptrptr = getelementptr [3 x ptr], ptr %vtable, i32 0, i32 1
+  %fptr = load ptr, ptr %fptrptr
+  ; CHECK: [[VTGEP2:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 24
+  ; CHECK: [[VTLOAD2:%[^ ]*]] = load i8, ptr [[VTGEP2]]
   ; CHECK: [[VTAND2:%[^ ]*]] = and i8 [[VTLOAD2]], 2
   ; CHECK: [[VTCMP2:%[^ ]*]] = icmp ne i8 [[VTAND2]], 0
-  %result = call i1 %fptr_casted(i8* %obj)
+  %result = call i1 %fptr(ptr %obj)
   ; CHECK: ret i1 [[VTCMP2]]
   ret i1 %result
 }
 
 ; CHECK: define i32 @call3(
-define i32 @call3(i8* %obj) {
-  %vtableptr = bitcast i8* %obj to [3 x i8*]**
-  %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
-  ; CHECK: {{.*}} = bitcast [3 x i8*]* {{.*}} to i8*
-  ; CHECK: [[VT3:%[^ ]*]] = bitcast [3 x i8*]* {{.*}} to i8*
-  %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
-  %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+define i32 @call3(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 2
-  %fptr = load i8*, i8** %fptrptr
-  %fptr_casted = bitcast i8* %fptr to i32 (i8*)*
-  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, i8* [[VT3]], i32 25
-  ; CHECK: [[VTBC3:%[^ ]*]] = bitcast i8* [[VTGEP3]] to i32*
-  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, i32* [[VTBC3]]
-  %result = call i32 %fptr_casted(i8* %obj)
+  %fptrptr = getelementptr [3 x ptr], ptr %vtable, i32 0, i32 2
+  %fptr = load ptr, ptr %fptrptr
+  ; CHECK: [[VTGEP3:%[^ ]*]] = getelementptr i8, ptr %vtable, i32 25
+  ; CHECK: [[VTLOAD3:%[^ ]*]] = load i32, ptr [[VTGEP3]]
+  %result = call i32 %fptr(ptr %obj)
   ; CHECK: ret i32 [[VTLOAD3]]
   ret i32 %result
 }
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
 ; CHECK: [[T8]] = !{i32 8, !"typeid"}

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-multiple-assumes.ll b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-multiple-assumes.ll
index d244c1aade37b..bd900217ba588 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-multiple-assumes.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/virtual-const-prop-multiple-assumes.ll
@@ -3,41 +3,37 @@
 target datalayout = "e-p:64:64"
 target triple = "x86_64-unknown-linux-gnu"
 
- at vt2 = constant [3 x i8*] [
-i8* bitcast (i1 (i8*)* @vf1i1 to i8*),
-i8* bitcast (i1 (i8*)* @vf0i1 to i8*),
-i8* bitcast (i32 (i8*)* @vf2i32 to i8*)
+ at vt2 = constant [3 x ptr] [
+ptr @vf1i1,
+ptr @vf0i1,
+ptr @vf2i32
 ], !type !0
 
-define i1 @vf0i1(i8* %this) readnone {
+define i1 @vf0i1(ptr %this) readnone {
   ret i1 0
 }
 
-define i1 @vf1i1(i8* %this) readnone {
+define i1 @vf1i1(ptr %this) readnone {
   ret i1 1
 }
 
-define i32 @vf2i32(i8* %this) readnone {
+define i32 @vf2i32(ptr %this) readnone {
   ret i32 2
 }
 
 ; CHECK: define i1 @call1(
-define i1 @call1(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 !"typeid")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p)
-  %p2 = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid")
+  %p2 = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   call void @llvm.assume(i1 %p2)
-  %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)
 
 !0 = !{i32 0, !"typeid"}
\ No newline at end of file

diff  --git a/llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll b/llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
index 4d19c57178ff9..027253ff66aeb 100644
--- a/llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
+++ b/llvm/test/Transforms/WholeProgramDevirt/vtable-decl.ll
@@ -4,21 +4,17 @@
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-none-linux-gnu"
 
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
 declare void @llvm.assume(i1)
 
- at _ZTVN3foo3barE = external dso_local unnamed_addr constant { [8 x i8*] }, align 8, !type !0
+ at _ZTVN3foo3barE = external dso_local unnamed_addr constant { [8 x ptr] }, align 8, !type !0
 
-define i1 @call1(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 !"typeid")
+define i1 @call1(ptr %obj) {
+  %vtable = load ptr, ptr %obj
+  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid")
   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
 }
 


        


More information about the llvm-commits mailing list