target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-@globalfuncAlias = alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-@globalfuncWeakAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-@globalfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-@globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-@globalfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
+@globalfuncAlias = alias void (...), ptr @globalfunc
+@globalfuncWeakAlias = weak alias void (...), ptr @globalfunc
+@globalfuncLinkonceAlias = linkonce alias void (...), ptr @globalfunc
+@globalfuncWeakODRAlias = weak_odr alias void (...), ptr @globalfunc
+@globalfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @globalfunc
define hidden void @globalfunc() {
entry:
ret void
}
-@internalfuncAlias = alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-@internalfuncWeakAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-@internalfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-@internalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-@internalfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
+@internalfuncAlias = alias void (...), ptr @internalfunc
+@internalfuncWeakAlias = weak alias void (...), ptr @internalfunc
+@internalfuncLinkonceAlias = linkonce alias void (...), ptr @internalfunc
+@internalfuncWeakODRAlias = weak_odr alias void (...), ptr @internalfunc
+@internalfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @internalfunc
define internal void @internalfunc() {
entry:
ret void
}
-@linkonceODRfuncAlias = alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-@linkonceODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-@linkonceODRfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-@linkonceODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-@linkonceODRfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
+@linkonceODRfuncAlias = alias void (...), ptr @linkonceODRfunc
+@linkonceODRfuncWeakAlias = weak alias void (...), ptr @linkonceODRfunc
+@linkonceODRfuncLinkonceAlias = linkonce alias void (...), ptr @linkonceODRfunc
+@linkonceODRfuncWeakODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
+@linkonceODRfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @linkonceODRfunc
define linkonce_odr void @linkonceODRfunc() {
entry:
ret void
}
-@weakODRfuncAlias = alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-@weakODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-@weakODRfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-@weakODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-@weakODRfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
+@weakODRfuncAlias = alias void (...), ptr @weakODRfunc
+@weakODRfuncWeakAlias = weak alias void (...), ptr @weakODRfunc
+@weakODRfuncLinkonceAlias = linkonce alias void (...), ptr @weakODRfunc
+@weakODRfuncWeakODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+@weakODRfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @weakODRfunc
define weak_odr void @weakODRfunc() {
entry:
ret void
}
-@linkoncefuncAlias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-@linkoncefuncWeakAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-@linkoncefuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-@linkoncefuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-@linkoncefuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
+@linkoncefuncAlias = alias void (...), ptr @linkoncefunc
+@linkoncefuncWeakAlias = weak alias void (...), ptr @linkoncefunc
+@linkoncefuncLinkonceAlias = linkonce alias void (...), ptr @linkoncefunc
+@linkoncefuncWeakODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+@linkoncefuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @linkoncefunc
define linkonce void @linkoncefunc() {
entry:
ret void
}
-@weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-@weakfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-@weakfuncLinkonceAlias = linkonce alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-@weakfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-@weakfuncLinkonceODRAlias = linkonce_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
+@weakfuncAlias = alias void (...), ptr @weakfunc
+@weakfuncWeakAlias = weak alias void (...), ptr @weakfunc
+@weakfuncLinkonceAlias = linkonce alias void (...), ptr @weakfunc
+@weakfuncWeakODRAlias = weak_odr alias void (...), ptr @weakfunc
+@weakfuncLinkonceODRAlias = linkonce_odr alias void (...), ptr @weakfunc
define weak void @weakfunc() {
entry:
ret void
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define internal i32 @f(i8*) unnamed_addr {
+define internal i32 @f(ptr) unnamed_addr {
ret i32 42
}
-@a2 = weak alias i32 (i8*), i32 (i8*)* @f
+@a2 = weak alias i32 (ptr), ptr @f
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define i1 @importf1(i8* %p) {
- %x = call i1 @f1(i8* %p)
+define i1 @importf1(ptr %p) {
+ %x = call i1 @f1(ptr %p)
ret i1 %x
}
-define i1 @importf2(i8* %p) {
- %x = call i1 @f2(i8* %p)
+define i1 @importf2(ptr %p) {
+ %x = call i1 @f2(ptr %p)
ret i1 %x
}
-declare i1 @f1(i8* %p)
-declare i1 @f2(i8* %p)
+declare i1 @f1(ptr %p)
+declare i1 @f2(ptr %p)
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"
-@vt2 = constant i1 (i8*)* @vf2, !type !0
+@vt2 = constant ptr @vf2, !type !0
-define internal i1 @vf2(i8* %this) {
+define internal i1 @vf2(ptr %this) {
ret i1 0
}
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"
-@vt2a = constant i1 (i8*)* @vf2a, !type !0
-@vt2b = constant i1 (i8*)* @vf2b, !type !0
+@vt2a = constant ptr @vf2a, !type !0
+@vt2b = constant ptr @vf2b, !type !0
-define internal i1 @vf2a(i8* %this) {
+define internal i1 @vf2a(ptr %this) {
ret i1 0
}
-define internal i1 @vf2b(i8* %this) {
+define internal i1 @vf2b(ptr %this) {
ret i1 1
}
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"
-@fptr = internal unnamed_addr global i32 (i32)* @f2, align 8
+@fptr = internal unnamed_addr global ptr @f2, align 8
define dso_local i32 @foo(i32 %x) local_unnamed_addr {
entry:
- %0 = load i32 (i32)*, i32 (i32)** @fptr, align 8
+ %0 = load ptr, ptr @fptr, align 8
%call = tail call i32 %0(i32 %x), !callees !0
ret i32 %call
}
br i1 %tobool, label %if.end, label %if.then
if.then: ; preds = %entry
- store i32 (i32)* @f1, i32 (i32)** @fptr, align 8
+ store ptr @f1, ptr @fptr, align 8
%sub.i = add nsw i32 %x, -1
br label %if.end
ret i32 %sub
}
-!0 = !{i32 (i32)* @f1, i32 (i32)* @f2}
+!0 = !{ptr @f1, ptr @f2}
target triple = "x86_64-grtev4-linux-gnu"
%struct.B2 = type { %struct.A2 }
-%struct.A2 = type { i32 (...)** }
+%struct.A2 = type { ptr }
%struct.B3 = type { %struct.A3 }
-%struct.A3 = type { i32 (...)** }
+%struct.A3 = type { ptr }
-@_ZTV1B2 = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+@_ZTV1B2 = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
-@_ZTV1B3 = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !1
+@_ZTV1B3 = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !1
-define void @test2(i8* %b) {
+define void @test2(ptr %b) {
entry:
- %0 = bitcast i8* %b to i8**
- %vtable2 = load i8*, i8** %0
- %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A2")
- br i1 %1, label %cont, label %trap
+ %vtable2 = load ptr, ptr %b
+ %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A2")
+ br i1 %0, label %cont, label %trap
trap:
tail call void @llvm.trap()
ret void
}
-define void @test1(i8* %b) {
+define void @test1(ptr %b) {
entry:
- %0 = bitcast i8* %b to i8**
- %vtable2 = load i8*, i8** %0
- %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A3")
- br i1 %1, label %cont, label %trap
+ %vtable2 = load ptr, ptr %b
+ %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A3")
+ br i1 %0, label %cont, label %trap
trap:
tail call void @llvm.trap()
ret void
}
-@test3 = hidden unnamed_addr alias void (i8*), void (i8*)* @test1
+@test3 = hidden unnamed_addr alias void (ptr), ptr @test1
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.trap()
!0 = !{i64 16, !"_ZTS1A2"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare !type !0 i8 @bar(i8*)
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare !type !0 i8 @bar(ptr)
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
-define i8 @baz(i8* %p) !type !0 {
- %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @baz(ptr %p) !type !0 {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
%1 = select i1 %x, i8 0, i8 3
ret i8 %1
}
-define i8 @qux(i8* %p) !type !0 {
- %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @qux(ptr %p) !type !0 {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
ret i8 4
}
-define i8 @g(i1 %i, i8* %p) {
- %1 = select i1 %i, i8(i8*)* @bar, i8(i8*)* @qux
- %2 = call i8 %1(i8* %p)
+define i8 @g(i1 %i, ptr %p) {
+ %1 = select i1 %i, ptr @bar, ptr @qux
+ %2 = call i8 %1(ptr %p)
ret i8 %2
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
-%struct.B = type { i32 (...)** }
+%struct.A = type { ptr }
+%struct.B = type { ptr }
-@_ZTV1B = linkonce_odr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1nEi to i8*)] }, !type !0
+@_ZTV1B = linkonce_odr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, !type !0
$test = comdat any
$testb = comdat any
-define linkonce_odr i32 @test(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @test(ptr %obj, i32 %a) comdat {
entry:
- %0 = bitcast %struct.A* %obj to i8**
- %vtable5 = load i8*, i8** %0
+ %vtable5 = load ptr, ptr %obj
- %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 8, metadata !"_ZTS1A")
- %2 = extractvalue { i8*, i1 } %1, 1
- br i1 %2, label %cont, label %trap
+ %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 8, metadata !"_ZTS1A")
+ %1 = extractvalue { ptr, i1 } %0, 1
+ br i1 %1, label %cont, label %trap
trap:
tail call void @llvm.trap()
unreachable
cont:
- %3 = extractvalue { i8*, i1 } %1, 0
- %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+ %2 = extractvalue { ptr, i1 } %0, 0
- %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
ret i32 %call
}
-define linkonce_odr i32 @testb(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @testb(ptr %obj, i32 %a) comdat {
entry:
- %0 = bitcast %struct.A* %obj to i8**
- %vtable5 = load i8*, i8** %0
+ %vtable5 = load ptr, ptr %obj
- %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 0, metadata !"_ZTS1A")
- %2 = extractvalue { i8*, i1 } %1, 1
- br i1 %2, label %cont, label %trap
+ %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 0, metadata !"_ZTS1A")
+ %1 = extractvalue { ptr, i1 } %0, 1
+ br i1 %1, label %cont, label %trap
trap:
tail call void @llvm.trap()
unreachable
cont:
- %3 = extractvalue { i8*, i1 } %1, 0
- %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+ %2 = extractvalue { ptr, i1 } %0, 0
- %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
ret i32 %call
}
-declare { i8*, i1 } @llvm.type.checked.load(i8*, i32, metadata)
+declare { ptr, i1 } @llvm.type.checked.load(ptr, i32, metadata)
declare void @llvm.trap()
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) {
entry:
ret i32 0
}
-define internal i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) {
+define internal i32 @_ZN1B1nEi(ptr %this, i32 %a) {
entry:
ret i32 0
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
%struct.C = type { %struct.A }
-%struct.D = type { i32 (...)** }
-%struct.E = type { i32 (...)** }
+%struct.D = type { ptr }
+%struct.E = type { ptr }
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1
-@_ZTV1C = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.C*, i32)* @_ZN1C1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !2
-@_ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
-@_ZTV1E = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.E*, i32)* @_ZN1E1mEi to i8*)] }, !type !4
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
+@_ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2
+@_ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
+@_ZTV1E = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1E1mEi] }, !type !4
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define i32 @_ZN1C1fEi(%struct.C* %this, i32 %a) #0 {
+define i32 @_ZN1C1fEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define linkonce_odr i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define internal i32 @_ZN1E1mEi(%struct.E* %this, i32 %a) #0 {
+define internal i32 @_ZN1E1mEi(ptr %this, i32 %a) #0 {
ret i32 0, !dbg !12
}
-define i32 @test2(%struct.E* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.E* %obj to i8***, !dbg !12
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1E")
+ %vtable2 = load ptr, ptr %obj
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1E")
call void @llvm.assume(i1 %p2)
- %2 = bitcast i8** %vtable2 to i32 (%struct.E*, i32)**
- %fptr33 = load i32 (%struct.E*, i32)*, i32 (%struct.E*, i32)** %2, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
- %call4 = tail call i32 %fptr33(%struct.E* nonnull %obj, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
ret i32 %call4
}
attributes #0 = { noinline optnone }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
!llvm.dbg.cu = !{!5}
target triple = "x86_64-unknown-linux-gnu"
%Derived = type { %Base }
-%Base = type { i32 (...)** }
+%Base = type { ptr }
-@_ZTV7Derived = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%Derived*)* @_ZN7DerivedD0Ev to i8*)] }, !type !0, !type !1, !vcall_visibility !2
-@_ZTV4Base = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* null, i8* bitcast (void (%Base*)* @_ZN4BaseD0Ev to i8*)] }, !type !0, !vcall_visibility !2
+@_ZTV7Derived = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN7DerivedD0Ev] }, !type !0, !type !1, !vcall_visibility !2
+@_ZTV4Base = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr null, ptr @_ZN4BaseD0Ev] }, !type !0, !vcall_visibility !2
-define void @_Z3fooP4Base(%Base* %b) {
+define void @_Z3fooP4Base(ptr %b) {
entry:
- %0 = bitcast %Base* %b to void (%Base*)***
- %vtable = load void (%Base*)**, void (%Base*)*** %0
- %1 = bitcast void (%Base*)** %vtable to i8*
- %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS4Base")
- tail call void @llvm.assume(i1 %2)
- %vfn = getelementptr inbounds void (%Base*)*, void (%Base*)** %vtable, i64 0
- %3 = load void (%Base*)*, void (%Base*)** %vfn
- tail call void %3(%Base* %b)
+ %vtable = load ptr, ptr %b
+ %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS4Base")
+ tail call void @llvm.assume(i1 %0)
+ %1 = load ptr, ptr %vtable
+ tail call void %1(ptr %b)
ret void
}
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-define void @_ZN7DerivedD0Ev(%Derived* %this) {
+define void @_ZN7DerivedD0Ev(ptr %this) {
ret void
}
-define void @_ZN4BaseD0Ev(%Base* %this) {
+define void @_ZN4BaseD0Ev(ptr %this) {
unreachable
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@some_name = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
-@_ZTV1D = alias { [3 x i8*] }, { [3 x i8*] }* @some_name
+@some_name = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
+@_ZTV1D = alias { [3 x ptr] }, ptr @some_name
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+@_ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
source_filename = "-"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
$_ZTV1B = comdat any
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, comdat, !type !0, !type !1
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, comdat, !type !0, !type !1
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
ret i32 0;
}
-define i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
ret i32 0;
}
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.B* %obj to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+ %vtable2 = load ptr, ptr %obj
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
call void @llvm.assume(i1 %p2)
- %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
- %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+ %fptr33 = load ptr, ptr %fptrptr, align 8
- %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
ret i32 %call4
}
attributes #0 = { noinline optnone }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
!0 = !{i64 16, !"_ZTS1A"}
source_filename = "-"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
-@_ZTV1B = internal constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1
+@_ZTV1B = internal constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.B* %obj to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+ %vtable2 = load ptr, ptr %obj
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
call void @llvm.assume(i1 %p2)
- %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
- %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+ %fptr33 = load ptr, ptr %fptrptr, align 8
- %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
ret i32 %call4
}
attributes #0 = { noinline optnone }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
!0 = !{i64 16, !"_ZTS1A"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define internal i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @test2(%struct.B* %obj, i32 %a) {
+define i32 @test2(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.B* %obj to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+ %vtable2 = load ptr, ptr %obj
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1B")
call void @llvm.assume(i1 %p2)
- %fptrptr = getelementptr i8*, i8** %vtable2, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.B*, i32)**
- %fptr33 = load i32 (%struct.B*, i32)*, i32 (%struct.B*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable2, i32 1
+ %fptr33 = load ptr, ptr %fptrptr, align 8
- %call4 = tail call i32 %fptr33(%struct.B* nonnull %obj, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj, i32 %a)
ret i32 %call4
}
attributes #0 = { noinline optnone }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
!0 = !{i64 16, !"_ZTS1A"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
$_ZNK1A1fEv = comdat any
$_ZTI1A = comdat any
-@_ZTV1A = linkonce_odr hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* bitcast ({ i8*, i8* }* @_ZTI1A to i8*), i8* bitcast (i32 (%struct.A*)* @_ZNK1A1fEv to i8*)] }, comdat, align 8, !type !0, !type !1
-@_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global i8*
+@_ZTV1A = linkonce_odr hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr @_ZTI1A, ptr @_ZNK1A1fEv] }, comdat, align 8, !type !0, !type !1
+@_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global ptr
@_ZTS1A = linkonce_odr hidden constant [3 x i8] c"1A\00", comdat, align 1
-@_ZTI1A = linkonce_odr hidden constant { i8*, i8* } { i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv117__class_type_infoE, i64 2) to i8*), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1A, i32 0, i32 0) }, comdat, align 8
+@_ZTI1A = linkonce_odr hidden constant { ptr, ptr } { ptr getelementptr inbounds (ptr, ptr @_ZTVN10__cxxabiv117__class_type_infoE, i64 2), ptr @_ZTS1A }, comdat, align 8
; Function Attrs: uwtable
define hidden i32 @_Z3barv() local_unnamed_addr #0 {
entry:
%b = alloca %struct.A, align 8
- %0 = bitcast %struct.A* %b to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %0)
- %1 = getelementptr inbounds %struct.A, %struct.A* %b, i64 0, i32 0
- store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTV1A, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %1, align 8, !tbaa !4
- %call = call i32 @_Z3fooP1A(%struct.A* nonnull %b)
+ call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %b)
+ store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV1A, i64 0, inrange i32 0, i64 2), ptr %b, align 8, !tbaa !4
+ %call = call i32 @_Z3fooP1A(ptr nonnull %b)
%add = add nsw i32 %call, 10
- call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %0) #4
+ call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %b) #4
ret i32 %add
}
; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
-declare dso_local i32 @_Z3fooP1A(%struct.A*) local_unnamed_addr
+declare dso_local i32 @_Z3fooP1A(ptr) local_unnamed_addr
; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
+declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture)
; Function Attrs: nounwind uwtable
-define linkonce_odr hidden i32 @_ZNK1A1fEv(%struct.A* %this) unnamed_addr comdat align 2 {
+define linkonce_odr hidden i32 @_ZNK1A1fEv(ptr %this) unnamed_addr comdat align 2 {
entry:
ret i32 3
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
; Function Attrs: uwtable
-define hidden i32 @_Z3fooP1A(%struct.A* %pA) local_unnamed_addr {
+define hidden i32 @_Z3fooP1A(ptr %pA) local_unnamed_addr {
entry:
- %0 = bitcast %struct.A* %pA to i32 (%struct.A*)***
- %vtable = load i32 (%struct.A*)**, i32 (%struct.A*)*** %0, align 8, !tbaa !2
- %1 = bitcast i32 (%struct.A*)** %vtable to i8*
- %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
- tail call void @llvm.assume(i1 %2)
- %3 = load i32 (%struct.A*)*, i32 (%struct.A*)** %vtable, align 8
- %call = tail call i32 %3(%struct.A* %pA)
+ %vtable = load ptr, ptr %pA, align 8, !tbaa !2
+ %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
+ tail call void @llvm.assume(i1 %0)
+ %1 = load ptr, ptr %vtable, align 8
+ %call = tail call i32 %1(ptr %pA)
%add = add nsw i32 %call, 10
ret i32 %add
}
; Function Attrs: nounwind readnone willreturn
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
; Function Attrs: nounwind willreturn
declare void @llvm.assume(i1)
%struct.Vec = type { i8 }
%struct.S = type { i8 }
-@_ZN4CFVSD1Ev = alias void (%struct.CFVS*), void (%struct.CFVS*)* @_ZN4CFVSD2Ev
+@_ZN4CFVSD1Ev = alias void (ptr), ptr @_ZN4CFVSD2Ev
-define void @_ZN4CFVSD2Ev(%struct.CFVS* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN4CFVSD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
entry:
- %this.addr = alloca %struct.CFVS*, align 8
- store %struct.CFVS* %this, %struct.CFVS** %this.addr, align 8
- %this1 = load %struct.CFVS*, %struct.CFVS** %this.addr, align 8
- %m_val = getelementptr inbounds %struct.CFVS, %struct.CFVS* %this1, i32 0, i32 0
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
ret void
}
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
%struct.Vec = type { i8 }
%struct.S = type { i8 }
-define void @_ZN4CFVSD2Ev(%struct.CFVS* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN4CFVSD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
entry:
- %this.addr = alloca %struct.CFVS*, align 8
- store %struct.CFVS* %this, %struct.CFVS** %this.addr, align 8
- %this1 = load %struct.CFVS*, %struct.CFVS** %this.addr, align 8
- %m_val = getelementptr inbounds %struct.CFVS, %struct.CFVS* %this1, i32 0, i32 0
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
ret void
}
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Vec<&Get>", file: !10, line: 4, size: 8, elements: !14, templateParams: !19, identifier: "_ZTS3VecIXadL_Z3GetvEEE")
!14 = !{!35}
!19 = !{!20}
-!20 = !DITemplateValueParameter(name: "F", type: !21, value: %struct.S* ()* @_Z3Getv)
+!20 = !DITemplateValueParameter(name: "F", type: !21, value: ptr @_Z3Getv)
!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64)
!22 = !DIDerivedType(tag: DW_TAG_typedef, name: "Func", file: !10, line: 2, baseType: !23)
!23 = !DISubroutineType(types: !24)
; Function Attrs: norecurse nounwind readonly uwtable
define i32 @foo() local_unnamed_addr #0 {
- %1 = load i32, i32* @B, align 4
- %2 = load i32, i32* @A, align 4
+ %1 = load i32, ptr @B, align 4
+ %2 = load i32, ptr @A, align 4
%3 = add nsw i32 %2, %1
ret i32 %3
}
define void @globalfunc() {
entry:
- %0 = load i8, i8* @argc, align 1
+ %0 = load i8, ptr @argc, align 1
tail call void @llvm.dbg.value(metadata i8 %0, i64 0, metadata !19, metadata !29), !dbg !DILocation(scope: !13)
ret void
}
define i32 @main() {
entry:
- %unused = call float @globalfunc1(i32* null, float*null)
+ %unused = call float @globalfunc1(ptr null, ptr null)
ret i32 0
}
-declare float @globalfunc1(i32*, float*)
\ No newline at end of file
+declare float @globalfunc1(ptr, ptr)
\ No newline at end of file
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"
-@label_addr = internal constant [1 x i8*] [i8* blockaddress(@bar, %lb)], align 8
+@label_addr = internal constant [1 x ptr] [ptr blockaddress(@bar, %lb)], align 8
; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local [1 x i8*]* @foo() {
- ret [1 x i8*]* @label_addr
+define dso_local ptr @foo() {
+ ret ptr @label_addr
}
; Function Attrs: noinline norecurse nounwind optnone uwtable
-define dso_local [1 x i8*]* @bar() {
+define dso_local ptr @bar() {
br label %lb
lb:
- ret [1 x i8*]* @label_addr
+ ret ptr @label_addr
}
@baz = internal constant i32 10, align 4
define linkonce_odr i32 @foo() {
- %1 = load i32, i32* @baz, align 4
+ %1 = load i32, ptr @baz, align 4
ret i32 %1
}
ret i64 0
}
-@llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
+@llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer
define i64 @G() {
- ;%1 = load i32, i32* @dummy2, align 4
+ ;%1 = load i32, ptr @dummy2, align 4
ret i64 0
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.S = type { i32, i32, i32* }
-%struct.Q = type { %struct.S* }
+%struct.S = type { i32, i32, ptr }
+%struct.Q = type { ptr }
@val = dso_local global i32 42, align 4
-@_ZL3Obj = internal constant %struct.S { i32 4, i32 8, i32* @val }, align 8
-@outer = dso_local local_unnamed_addr global %struct.Q { %struct.S* @_ZL3Obj }, align 8
+@_ZL3Obj = internal constant %struct.S { i32 4, i32 8, ptr @val }, align 8
+@outer = dso_local local_unnamed_addr global %struct.Q { ptr @_ZL3Obj }, align 8
-define dso_local nonnull %struct.S* @_Z6getObjv() local_unnamed_addr {
+define dso_local nonnull ptr @_Z6getObjv() local_unnamed_addr {
entry:
- store %struct.S* null, %struct.S** getelementptr inbounds (%struct.Q, %struct.Q* @outer, i64 1, i32 0), align 8
- ret %struct.S* @_ZL3Obj
+ store ptr null, ptr getelementptr inbounds (%struct.Q, ptr @outer, i64 1, i32 0), align 8
+ ret ptr @_ZL3Obj
}
define i32 @foo(i32 %goo) {
entry:
%goo.addr = alloca i32, align 4
- store i32 %goo, i32* %goo.addr, align 4
- %0 = load i32, i32* %goo.addr, align 4
- %1 = load i32, i32* %goo.addr, align 4
+ store i32 %goo, ptr %goo.addr, align 4
+ %0 = load i32, ptr %goo.addr, align 4
+ %1 = load i32, ptr %goo.addr, align 4
%mul = mul nsw i32 %0, %1
ret i32 %mul
}
target triple = "x86_64-unknown-linux-gnu"
@g = global i32 42, align 4
-@g.alias = weak alias i32, i32* @g
+@g.alias = weak alias i32, ptr @g
; Function Attrs: norecurse nounwind readonly ssp uwtable
define i32 @foo() local_unnamed_addr {
- %1 = load i32, i32* @gFoo, align 4
+ %1 = load i32, ptr @gFoo, align 4
ret i32 %1
}
; Function Attrs: nounwind ssp uwtable
define void @bar() local_unnamed_addr {
%1 = tail call i32 @rand()
- store i32 %1, i32* @gFoo, align 4
+ store i32 %1, ptr @gFoo, align 4
ret void
}
@g = external global i32
define i32 @foo() {
- %v = load i32, i32* @g
+ %v = load i32, ptr @g
ret i32 %v
}
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"
-@b = dso_local global i32* @a, align 8
+@b = dso_local global ptr @a, align 8
@a = dso_local global i32 42, align 4
@g3 = available_externally global i32 42, align 4
define i32 @foo() {
- %v1 = load i32, i32* @g1
- %v2 = load i32, i32* @g2
- %v3 = load i32, i32* @g3
+ %v1 = load i32, ptr @g1
+ %v2 = load i32, ptr @g2
+ %v3 = load i32, ptr @g3
%s1 = add i32 %v1, %v2
%s2 = add i32 %s1, %v3
ret i32 %s2
; Function Attrs: norecurse nounwind readonly
define i32 @foo() local_unnamed_addr #0 !dbg !14 {
- %1 = load i32, i32* @gFoo, align 4, !dbg !17
+ %1 = load i32, ptr @gFoo, align 4, !dbg !17
ret i32 %1, !dbg !18
}
; Function Attrs: norecurse nounwind readonly
define i32 @bar() local_unnamed_addr #0 !dbg !19 {
- %1 = load i32, i32* @gBar, align 4, !dbg !20
+ %1 = load i32, ptr @gBar, align 4, !dbg !20
ret i32 %1, !dbg !21
}
define void @baz() local_unnamed_addr !dbg !22 {
%1 = tail call i32 @rand(), !dbg !25
- store i32 %1, i32* @gFoo, align 4, !dbg !26
+ store i32 %1, ptr @gFoo, align 4, !dbg !26
%2 = tail call i32 @rand(), !dbg !27
- store i32 %2, i32* @gBar, align 4, !dbg !28
+ store i32 %2, ptr @gBar, align 4, !dbg !28
ret void, !dbg !29
}
@g_private = private global i32 41, comdat($g)
-define linkonce_odr i32 @f(i8*) unnamed_addr comdat($f) {
+define linkonce_odr i32 @f(ptr) unnamed_addr comdat($f) {
ret i32 41
}
}
define i32 @h() {
- %i = call i32 @f(i8* null)
+ %i = call i32 @f(ptr null)
ret i32 %i
}
; Function Attrs: noinline nounwind uwtable
define internal i32 @foo() {
entry:
- %0 = load i32, i32* @baz, align 4
+ %0 = load i32, ptr @baz, align 4
ret i32 %0
}
; Function Attrs: noinline nounwind uwtable
define internal i32 @foo() {
entry:
- %0 = load i32, i32* @baz, align 4
+ %0 = load i32, ptr @baz, align 4
ret i32 %0
}
; Function Attrs: noinline nounwind uwtable
define i32 @a() {
entry:
- %0 = load i32, i32* @baz, align 4
+ %0 = load i32, ptr @baz, align 4
ret i32 %0
}
; Function Attrs: noinline nounwind uwtable
define i32 @b() {
entry:
- %0 = load i32, i32* @baz, align 4
+ %0 = load i32, ptr @baz, align 4
ret i32 %0
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define i32 @main({ i64, { i64, i8* }* } %unnamed) #0 {
+define i32 @main({ i64, ptr } %unnamed) #0 {
%1 = call i32 @func1() #1
%2 = call i32 @func2() #1
%3 = call i32 @func3() #1
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
-define void @bar() personality i32 (i32, i32, i64, i8*, i8*)* @personality_routine {
+define void @bar() personality ptr @personality_routine {
ret void
}
-define protected i32 @personality_routine(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine(i32, i32, i64, ptr, ptr) {
ret i32 0
}
-define protected i32 @personality_routine2(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine2(i32, i32, i64, ptr, ptr) {
ret i32 0
}
-define protected i32 @personality_routine3(i32, i32, i64, i8*, i8*) {
+define protected i32 @personality_routine3(i32, i32, i64, ptr, ptr) {
ret i32 0
}
; Function Attrs: noinline nounwind uwtable
define internal i32 @foo() {
entry:
- %0 = load i32, i32* @baz, align 4
+ %0 = load i32, ptr @baz, align 4
ret i32 %0
}
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
-declare i8 **@foo()
+declare ptr@foo()
define i32 @main() {
- call i8 **@foo()
+ call ptr@foo()
ret i32 0
}
ret void
}
-@someglobal = internal unnamed_addr constant i8* bitcast (void ()* @referencedbyglobal to i8*)
-@someglobal2 = internal unnamed_addr constant i8* bitcast (void ()* @localreferencedbyglobal to i8*)
-@ptr = global i8** null
-@ptr2 = global i8** null
+@someglobal = internal unnamed_addr constant ptr @referencedbyglobal
+@someglobal2 = internal unnamed_addr constant ptr @localreferencedbyglobal
+@ptr = global ptr null
+@ptr2 = global ptr null
define void @bar() #0 align 2 {
- store i8** getelementptr inbounds (i8*, i8** @someglobal, i64 0) , i8*** @ptr, align 8
- store i8** getelementptr inbounds (i8*, i8** @someglobal2, i64 0) , i8*** @ptr2, align 8
+ store ptr @someglobal , ptr @ptr, align 8
+ store ptr @someglobal2 , ptr @ptr2, align 8
ret void
}
; @reference_gv_with_section() can't be imported
define i32 @reference_gv_with_section() {
- %res = load i32, i32* @var_with_section
+ %res = load i32, ptr @var_with_section
ret i32 %res
}
-@foo = weak alias i32 (...), bitcast (i32 ()* @foo1 to i32 (...)*)
+@foo = weak alias i32 (...), @foo1
define i32 @foo1() {
ret i32 42
-@foo = alias i32 (...), bitcast (i32 ()* @foo2 to i32 (...)*)
+@foo = alias i32 (...), @foo2
define linkonce_odr i32 @foo2() {
%ret = add i32 42, 42
target triple = "x86_64-apple-macosx10.11.0"
; Alias are not optimized
-@linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
+@linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
; Alias are not optimized
-@linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
+@linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
; Function with an alias are not optimized
define linkonce_odr void @linkonceodrfuncwithalias() #0 {
target triple = "x86_64-unknown-linux-gnu"
%struct.S = type { i32 }
-%struct.Q = type { %struct.S* }
+%struct.Q = type { ptr }
@_ZL3Obj = internal constant %struct.S { i32 42 }, align 4
-@outer = dso_local local_unnamed_addr global %struct.Q { %struct.S* @_ZL3Obj }, align 8
+@outer = dso_local local_unnamed_addr global %struct.Q { ptr @_ZL3Obj }, align 8
; Function Attrs: nofree norecurse nounwind uwtable writeonly
define dso_local void @_Z3foov() local_unnamed_addr {
entry:
- store %struct.S* null, %struct.S** getelementptr inbounds (%struct.Q, %struct.Q* @outer, i64 0, i32 0), align 8
+ store ptr null, ptr @outer, align 8
ret void
}
@foo = ifunc i32 (i32), ptr @foo_resolver
; CHECK-RESOLVER: (name: "foo_resolver"
; CHECK-RESOLVER-SAME: live: 1
-define internal i32 (i32)* @foo_resolver() {
+define internal ptr @foo_resolver() {
entry:
- ret i32 (i32)* null
+ ret ptr null
}
; CHECK-BAR: (name: "bar"
; CHECK-BAR-NOT: summaries: (
; CHECK-QUUX: (name: "quux"
; CHECK-QUUX-SAME: live: 1
-@quux = internal alias i32 (i32)* (), ptr @foo_resolver
+@quux = internal alias ptr (), ptr @foo_resolver
@quuz = internal ifunc i32 (i32), ptr @quux
; CHECK-CORGE: (name: "corge"
; Alias can't point to "available_externally", so they are implemented by
; importing the alias as an available_externally definition copied from the
; aliasee's body.
-; PROMOTE-DAG: @globalfuncAlias = alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncWeakAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @globalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @globalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncAlias = alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncWeakAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @internalfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @internalfunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncAlias = alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncWeakAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @linkoncefuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkoncefunc to void (...)*)
-; PROMOTE-DAG: @weakfuncAlias = alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncAlias = alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @weakODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @weakODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncAlias = alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncWeakAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncWeakODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
-; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), bitcast (void ()* @linkonceODRfunc to void (...)*)
+; PROMOTE-DAG: @globalfuncAlias = alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncWeakAlias = weak alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncLinkonceAlias = weak alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncWeakODRAlias = weak_odr alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @globalfuncLinkonceODRAlias = weak_odr alias void (...), ptr @globalfunc
+; PROMOTE-DAG: @internalfuncAlias = alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncWeakAlias = weak alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncLinkonceAlias = weak alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncWeakODRAlias = weak_odr alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @internalfuncLinkonceODRAlias = weak_odr alias void (...), ptr @internalfunc
+; PROMOTE-DAG: @linkoncefuncAlias = alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncWeakAlias = weak alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncLinkonceAlias = weak alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncWeakODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @linkoncefuncLinkonceODRAlias = weak_odr alias void (...), ptr @linkoncefunc
+; PROMOTE-DAG: @weakfuncAlias = alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncWeakAlias = weak alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncLinkonceAlias = weak alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncWeakODRAlias = weak_odr alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakfuncLinkonceODRAlias = weak_odr alias void (...), ptr @weakfunc
+; PROMOTE-DAG: @weakODRfuncAlias = alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncWeakAlias = weak alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncLinkonceAlias = weak alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncWeakODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @weakODRfuncLinkonceODRAlias = weak_odr alias void (...), ptr @weakODRfunc
+; PROMOTE-DAG: @linkonceODRfuncAlias = alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncWeakAlias = weak alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncWeakODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncLinkonceAlias = weak alias void (...), ptr @linkonceODRfunc
+; PROMOTE-DAG: @linkonceODRfuncLinkonceODRAlias = weak_odr alias void (...), ptr @linkonceODRfunc
; PROMOTE-DAG: define hidden void @globalfunc()
; PROMOTE-DAG: define internal void @internalfunc()
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define internal i32 @f(i8*) unnamed_addr {
+define internal i32 @f(ptr) unnamed_addr {
ret i32 42
}
-@a1 = weak alias i32 (i8*), i32 (i8*)* @f
+@a1 = weak alias i32 (ptr), ptr @f
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define i8* @ref() {
+define ptr @ref() {
entry:
- %0 = tail call i8* asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
- ret i8* %0
+ %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
+ ret ptr %0
}
;--- b.s
; CHECK: @ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
@ff_h264_cabac_tables = dso_local constant [1 x i8] c"\09"
-@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast ([1 x i8]* @ff_h264_cabac_tables to i8*)], section "llvm.metadata"
+@llvm.compiler.used = appending global [1 x ptr] [ptr @ff_h264_cabac_tables], section "llvm.metadata"
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"
-@f1 = alias i1(i8*), i1 (i8*)* @f1_actual
+@f1 = alias i1(ptr), ptr @f1_actual
-define i1 @f1_actual(i8* %p) {
- %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
+define i1 @f1_actual(ptr %p) {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1")
ret i1 %x
}
-define i1 @f2(i8* %obj) {
- %vtableptr = bitcast i8* %obj to [3 x i8*]**
- %vtable = load [3 x i8*]*, [3 x i8*]** %vtableptr
- %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"typeid2")
+define i1 @f2(ptr %obj) {
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 0
- %fptr = load i8*, i8** %fptrptr
- %fptr_casted = bitcast i8* %fptr to i1 (i8*)*
- %result = call i1 %fptr_casted(i8* %obj)
+ %fptr = load ptr, ptr %vtable
+ %result = call i1 %fptr(ptr %obj)
ret i1 %result
}
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
target triple = "x86_64-grtev4-linux-gnu"
%struct.B = type { %struct.A }
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
-@_ZTV1B = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+@_ZTV1B = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
-define void @test(i8* %b) {
+define void @test(ptr %b) {
entry:
- tail call void @test2(i8* %b)
- tail call void @test3(i8* %b)
- %0 = bitcast i8* %b to i8**
- %vtable2 = load i8*, i8** %0
- %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A")
- br i1 %1, label %cont, label %trap
+ tail call void @test2(ptr %b)
+ tail call void @test3(ptr %b)
+ %vtable2 = load ptr, ptr %b
+ %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A")
+ br i1 %0, label %cont, label %trap
trap:
tail call void @llvm.trap()
ret void
}
-declare void @test2(i8*)
-declare void @test3(i8*)
-declare i1 @llvm.type.test(i8*, metadata)
+declare void @test2(ptr)
+declare void @test3(ptr)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.trap()
!0 = !{i64 16, !"_ZTS1A"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare !type !0 i8 @baz(i8*)
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare !type !0 i8 @baz(ptr)
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
-define i8 @foo(i8* %p) !type !0 {
- %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @foo(ptr %p) !type !0 {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
%1 = select i1 %x, i8 0, i8 1
ret i8 %1
}
-define i8 @bar(i8* %p) !type !0 {
- %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
+define i8 @bar(ptr %p) !type !0 {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")
ret i8 2
}
-define i8 @f(i1 %i, i8* %p) {
- %1 = select i1 %i, i8(i8*)* @foo, i8(i8*)* @baz
- %2 = call i8 %1(i8* %p)
+define i8 @f(i1 %i, ptr %p) {
+ %1 = select i1 %i, ptr @foo, ptr @baz
+ %2 = call i8 %1(ptr %p)
ret i8 %2
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-define i1 @foo(i8* %p) !type !0 {
+define i1 @foo(ptr %p) !type !0 {
entry:
- %x = call i1 @llvm.type.test(i8* %p, metadata !"typeid1")
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1")
ret i1 %x
}
-declare !type !0 i1 @bar(i8*)
+declare !type !0 i1 @bar(ptr)
; Functions must be address taken to have jump table entries emitted
define void @addrtaken(i1 %i) {
- %1 = select i1 %i, i1(i8*)* @foo, i1(i8*)* @bar
+ %1 = select i1 %i, ptr @foo, ptr @bar
ret void
}
-declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
+declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
!0 = !{i64 0, !"typeid1"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
$test2 = comdat any
-define linkonce_odr i32 @test2(%struct.A* %obj, i32 %a) comdat {
+define linkonce_odr i32 @test2(ptr %obj, i32 %a) comdat {
entry:
- %0 = bitcast %struct.A* %obj to i8**
- %vtable5 = load i8*, i8** %0
+ %vtable5 = load ptr, ptr %obj
- %1 = tail call { i8*, i1 } @llvm.type.checked.load(i8* %vtable5, i32 8, metadata !"_ZTS1A")
- %2 = extractvalue { i8*, i1 } %1, 1
- br i1 %2, label %cont, label %trap
+ %0 = tail call { ptr, i1 } @llvm.type.checked.load(ptr %vtable5, i32 8, metadata !"_ZTS1A")
+ %1 = extractvalue { ptr, i1 } %0, 1
+ br i1 %1, label %cont, label %trap
trap:
tail call void @llvm.trap()
unreachable
cont:
- %3 = extractvalue { i8*, i1 } %1, 0
- %4 = bitcast i8* %3 to i32 (%struct.A*, i32)*
+ %2 = extractvalue { ptr, i1 } %0, 0
- %call = tail call i32 %4(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %2(ptr nonnull %obj, i32 %a)
ret i32 %call
}
; CHECK-IR1-NEXT: unreachable
; CHECK-IR1-NEXT: }
-declare { i8*, i1 } @llvm.type.checked.load(i8*, i32, metadata)
+declare { ptr, i1 } @llvm.type.checked.load(ptr, i32, metadata)
declare void @llvm.trap()
target triple = "x86_64-grtev4-linux-gnu"
%struct.B = type { %struct.A }
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
-@_ZTV1B = constant { [3 x i8*] } { [3 x i8*] [i8* undef, i8* undef, i8* undef] }, !type !0
+@_ZTV1B = constant { [3 x ptr] } { [3 x ptr] [ptr undef, ptr undef, ptr undef] }, !type !0
; CHECK-IR-LABEL: define void @test
-define void @test(i8* %b) {
+define void @test(ptr %b) {
entry:
; Ensure that traps are conditional. Invalid TYPE_ID can cause
; unconditional traps.
; CHECK-IR: br i1 {{.*}}, label %trap
- %0 = bitcast i8* %b to i8**
- %vtable2 = load i8*, i8** %0
- %1 = tail call i1 @llvm.type.test(i8* %vtable2, metadata !"_ZTS1A")
- br i1 %1, label %cont, label %trap
+ %vtable2 = load ptr, ptr %b
+ %0 = tail call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1A")
+ br i1 %0, label %cont, label %trap
trap:
tail call void @llvm.trap()
}
; CHECK-IR-LABEL: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.trap()
-declare i32 @_ZN1B1fEi(%struct.B* %this, i32 %a)
+declare i32 @_ZN1B1fEi(ptr %this, i32 %a)
!0 = !{i64 16, !"_ZTS1A"}
!1 = !{i64 16, !"_ZTS1B"}
;; template <typename T>
;; struct A { A() {} virtual ~A() {} };
;; template struct A<void>;
-;; void *foo() { return new A<void>; }
+;; ptr foo() { return new A<void>; }
;;
;; clang -c -fpic -O1 -flto=thin a.cc && cp a.o b.o && ld.lld -shared a.o b.so
;; template <typename T>
;; struct A final { virtual ~A() {} };
;; template struct A<int>;
-;; extern "C" void bb(A<int> *a) { delete a; }
+;; extern "C" void bb(Aptr a) { delete a; }
;;
;; clang -c -fpic -O0 -flto=thin a.cc && ld.lld -shared a.o b.o
;;
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%class.A = type { i32 (...)** }
+%class.A = type { ptr }
%class.B = type { %class.A }
-@_ZTV1A = linkonce_odr hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%class.A*)* @_ZN1A3fooEv to i8*), i8* bitcast (i32 (%class.A*)* @_ZN1A3barEv to i8*)] }, align 8, !type !0
-@_ZTV1B = hidden unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%class.B*)* @_ZN1B3fooEv to i8*), i8* bitcast (i32 (%class.B*)* @_ZN1B3barEv to i8*)] }, align 8, !type !0, !type !1
+@_ZTV1A = linkonce_odr hidden unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1A3fooEv, ptr @_ZN1A3barEv] }, align 8, !type !0
+@_ZTV1B = hidden unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B3fooEv, ptr @_ZN1B3barEv] }, align 8, !type !0, !type !1
-define hidden i32 @_Z3bazP1A(%class.A* %a) local_unnamed_addr {
+define hidden i32 @_Z3bazP1A(ptr %a) local_unnamed_addr {
entry:
- %0 = bitcast %class.A* %a to i32 (%class.A*)***
- %vtable = load i32 (%class.A*)**, i32 (%class.A*)*** %0, align 8
- %1 = bitcast i32 (%class.A*)** %vtable to i8*
- %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
- tail call void @llvm.assume(i1 %2)
- %3 = load i32 (%class.A*)*, i32 (%class.A*)** %vtable, align 8
+ %vtable = load ptr, ptr %a, align 8
+ %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
+ tail call void @llvm.assume(i1 %0)
+ %1 = load ptr, ptr %vtable, align 8
; This is the compare instruction inserted by ICP
- %4 = icmp eq i32 (%class.A*)* %3, bitcast (i32 (%class.B*)* @_ZN1B3fooEv to i32 (%class.A*)*)
- br i1 %4, label %if.true.direct_targ, label %if.false.orig_indirect
+ %2 = icmp eq ptr %1, @_ZN1B3fooEv
+ br i1 %2, label %if.true.direct_targ, label %if.false.orig_indirect
; This block contains the promoted and inlined call to B::foo();
; CHECK-IR: if.true.direct_targ: ; preds = %entry
if.true.direct_targ: ; preds = %entry
- %5 = bitcast %class.A* %a to %class.B*
- %6 = bitcast i32 (%class.A*)** %vtable to i8*
- %7 = tail call i1 @llvm.type.test(i8* %6, metadata !"_ZTS1B")
- tail call void @llvm.assume(i1 %7)
- %vfn.i1 = getelementptr inbounds i32 (%class.A*)*, i32 (%class.A*)** %vtable, i64 1
- %vfn.i = bitcast i32 (%class.A*)** %vfn.i1 to i32 (%class.B*)**
- %8 = load i32 (%class.B*)*, i32 (%class.B*)** %vfn.i, align 8
+ %3 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1B")
+ tail call void @llvm.assume(i1 %3)
+ %vfn.i1 = getelementptr inbounds ptr, ptr %vtable, i64 1
+ %4 = load ptr, ptr %vfn.i1, align 8
; Call to bar() can be devirtualized to call to B::bar(), since it was
; inlined from B::foo() after ICP introduced the guarded promotion.
; CHECK-IR: %call.i = tail call i32 @_ZN1B3barEv(ptr nonnull %a)
- %call.i = tail call i32 %8(%class.B* %5)
+ %call.i = tail call i32 %4(ptr %a)
br label %if.end.icp
; This block contains the fallback indirect call a->foo()
if.false.orig_indirect: ; preds = %entry
; Fallback indirect call to foo() cannot be devirtualized.
; CHECK-IR: %call = tail call i32 %
- %call = tail call i32 %3(%class.A* nonnull %a)
+ %call = tail call i32 %1(ptr nonnull %a)
br label %if.end.icp
if.end.icp: ; preds = %if.false.orig_indirect, %if.true.direct_targ
- %9 = phi i32 [ %call, %if.false.orig_indirect ], [ %call.i, %if.true.direct_targ ]
- ret i32 %9
+ %5 = phi i32 [ %call, %if.false.orig_indirect ], [ %call.i, %if.true.direct_targ ]
+ ret i32 %5
}
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-declare dso_local i32 @_ZN1B3fooEv(%class.B* %this) unnamed_addr
-declare dso_local i32 @_ZN1B3barEv(%class.B*) unnamed_addr
-declare dso_local i32 @_ZN1A3barEv(%class.A* %this) unnamed_addr
-declare dso_local i32 @_ZN1A3fooEv(%class.A* %this) unnamed_addr
+declare dso_local i32 @_ZN1B3fooEv(ptr %this) unnamed_addr
+declare dso_local i32 @_ZN1B3barEv(ptr) unnamed_addr
+declare dso_local i32 @_ZN1A3barEv(ptr %this) unnamed_addr
+declare dso_local i32 @_ZN1A3fooEv(ptr %this) unnamed_addr
!0 = !{i64 16, !"_ZTS1A"}
!1 = !{i64 16, !"_ZTS1B"}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
%struct.C = type { %struct.A }
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1
-@_ZTV1C = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.C*, i32)* @_ZN1C1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !2
-@_ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1
+@_ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2
+@_ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
; CHECK-IR-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was devirtualized.
; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
; Ensure !prof and !callees metadata for indirect call promotion removed.
; CHECK-IR-NOT: prof
; CHECK-IR-NOT: callees
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a), !prof !5, !callees !6
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a), !prof !5, !callees !6
- %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
- %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+ %fptr22 = load ptr, ptr %vtable, align 8
; We still have to call it as virtual.
; CHECK-IR: %call3 = tail call i32 %fptr22
- %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+ %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
- %4 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %4
- %5 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %5, metadata !4)
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
call void @llvm.assume(i1 %p2)
- %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was devirtualized.
; CHECK-IR: %call4 = tail call i32 @_ZN1D1mEi
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
ret i32 %call4
}
; CHECK-IR-LABEL: ret i32
; CHECK-IR-LABEL: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1C1fEi(%struct.C* %this, i32 %a) #0 {
+define i32 @_ZN1C1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
!3 = !{i64 16, !4}
!4 = distinct !{}
!5 = !{!"VP", i32 0, i64 1, i64 1621563287929432257, i64 1}
-!6 = !{i32 (%struct.A*, i32)* @_ZN1A1nEi}
+!6 = !{ptr @_ZN1A1nEi}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
%struct.C = type { %struct.A }
-%struct.D = type { i32 (...)** }
-%struct.E = type { i32 (...)** }
+%struct.D = type { ptr }
+%struct.E = type { ptr }
-@_ZTV1B = external constant [4 x i8*]
-@_ZTV1C = external constant [4 x i8*]
-;@_ZTV1D = external constant [3 x i8*]
-@_ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+@_ZTV1B = external constant [4 x ptr]
+@_ZTV1C = external constant [4 x ptr]
+;@_ZTV1D = external constant [3 x ptr]
+@_ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
-define linkonce_odr i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0
}
; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, %struct.E* %obj3, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, ptr %obj3, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was devirtualized. Ignore extra character before
; symbol name which would happen if it was promoted during module
; splitting for hybrid WPD.
; CHECK-IR1: %call = tail call i32 @_ZN1A1nEi
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
- %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
- %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+ %fptr22 = load ptr, ptr %vtable, align 8
; We still have to call it as virtual.
; CHECK-IR1: %call3 = tail call i32 %fptr22
- %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+ %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
- %4 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %4
- %5 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %5, metadata !"_ZTS1D")
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
call void @llvm.assume(i1 %p2)
- %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was devirtualized.
; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
- %call5 = tail call i32 @test2(%struct.E* nonnull %obj3, i32 %call4)
+ %call5 = tail call i32 @test2(ptr nonnull %obj3, i32 %call4)
ret i32 %call5
}
; CHECK-IR1-LABEL: ret i32
; splitting for hybrid WPD.
; CHECK-IR2-NEXT: %call4 = tail call i32 @{{.*}}_ZN1E1mEi
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-declare i32 @test2(%struct.E* %obj, i32 %a)
+declare i32 @test2(ptr %obj, i32 %a)
attributes #0 = { noinline optnone }
target triple = "x86_64-unknown-linux-gnu"
%Derived = type { %Base }
-%Base = type { i32 (...)** }
+%Base = type { ptr }
-@_ZTV7Derived = external constant { [5 x i8*] }
+@_ZTV7Derived = external constant { [5 x ptr] }
define hidden i32 @main() {
entry:
- %call = tail call i8* @_Znwm(i64 8)
- %0 = bitcast i8* %call to %Derived*
- %1 = getelementptr inbounds %Derived, %Derived* %0, i64 0, i32 0, i32 0
- store i32 (...)** bitcast (i8** getelementptr inbounds ({ [5 x i8*] }, { [5 x i8*] }* @_ZTV7Derived, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %1
- %2 = getelementptr %Derived, %Derived* %0, i64 0, i32 0
- tail call void @_Z3fooP4Base(%Base* nonnull %2)
+ %call = tail call ptr @_Znwm(i64 8)
+ store ptr getelementptr inbounds ({ [5 x ptr] }, ptr @_ZTV7Derived, i64 0, inrange i32 0, i64 2), ptr %call
+ tail call void @_Z3fooP4Base(ptr nonnull %call)
ret i32 0
}
-declare i8* @_Znwm(i64)
+declare ptr @_Znwm(i64)
-declare void @_Z3fooP4Base(%Base*)
+declare void @_Z3fooP4Base(ptr)
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+@_ZTV1D = linkonce_odr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj2, i32 %a) {
entry:
- %0 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1D")
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
call void @llvm.assume(i1 %p2)
- %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was devirtualized.
; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %a)
ret i32 %call4
}
; CHECK-IR1-LABEL: ret i32
; CHECK-IR1-LABEL: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
attributes #0 = { noinline optnone }
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1D = available_externally constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }
+@_ZTV1D = available_externally constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }
; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj2, i32 %a) {
entry:
- %0 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1D")
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !"_ZTS1D")
call void @llvm.assume(i1 %p2)
- %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was devirtualized.
; CHECK-IR1: %call4 = tail call i32 @_ZN1D1mEi
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %a)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %a)
ret i32 %call4
}
; CHECK-IR1-LABEL: ret i32
; CHECK-IR1-LABEL: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
attributes #0 = { noinline optnone }
source_filename = "-"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
$_ZTV1B = comdat any
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1nEi to i8*)] }, comdat, !type !0, !type !1
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, comdat, !type !0, !type !1
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
ret i32 0;
}
-define i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) #0 comdat($_ZTV1B) {
+define i32 @_ZN1B1nEi(ptr %this, i32 %a) #0 comdat($_ZTV1B) {
ret i32 0;
}
; Ensures that vtable of B is live so that we will attempt devirt.
-define dso_local i32 @use_B(%struct.B* %a) {
+define dso_local i32 @use_B(ptr %a) {
entry:
- %0 = bitcast %struct.B* %a to i32 (...)***
- store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV1B, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV1B, i64 0, inrange i32 0, i64 2), ptr %a, align 8
ret i32 0
}
; CHECK-IR1: define i32 @test(
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was devirtualized.
; CHECK-IR1: tail call i32 {{.*}}@_ZN1A1nEi
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
ret i32 %call
}
; Check that the call was devirtualized.
; CHECK-IR2: tail call i32 @_ZN1A1nEi
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
attributes #0 = { noinline optnone }
source_filename = "-"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
-@_ZTV1B = internal constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1nEi to i8*)] }, !type !0, !type !1
+@_ZTV1B = internal constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1B1nEi] }, !type !0, !type !1
-define internal i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define internal i32 @_ZN1B1nEi(%struct.B* %this, i32 %a) #0 {
+define internal i32 @_ZN1B1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
; Ensures that vtable of B is live so that we will attempt devirt.
-define dso_local i32 @use_B(%struct.B* %a) {
+define dso_local i32 @use_B(ptr %a) {
entry:
- %0 = bitcast %struct.B* %a to i32 (...)***
- store i32 (...)** bitcast (i8** getelementptr inbounds ({ [4 x i8*] }, { [4 x i8*] }* @_ZTV1B, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV1B, i64 0, inrange i32 0, i64 2), ptr %a, align 8
ret i32 0
}
; CHECK-IR1: define i32 @test(
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was not devirtualized.
; CHECK-IR1: %call = tail call i32 %fptr1
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
ret i32 %call
}
; Check that the call was not devirtualized.
; CHECK-IR2: %call4 = tail call i32 %fptr
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
attributes #0 = { noinline optnone }
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%class.A = type { i32 (...)** }
+%class.A = type { ptr }
%class.B = type { %class.A }
-@_ZTV1A = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (void (%class.A*)* @_ZN1A3fooEv to i8*)] }, align 8, !type !0, !vcall_visibility !2
-@_ZTV1B = hidden unnamed_addr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (void (%class.B*)* @_ZN1B3fooEv to i8*)] }, align 8, !type !0, !type !3, !vcall_visibility !2
+@_ZTV1A = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1A3fooEv] }, align 8, !type !0, !vcall_visibility !2
+@_ZTV1B = hidden unnamed_addr constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1B3fooEv] }, align 8, !type !0, !type !3, !vcall_visibility !2
-declare void @_ZN1A3fooEv(%class.A* nocapture %this)
+declare void @_ZN1A3fooEv(ptr nocapture %this)
-define hidden void @_ZN1B3fooEv(%class.B* nocapture %this) {
+define hidden void @_ZN1B3fooEv(ptr nocapture %this) {
entry:
ret void
}
; Function Attrs: nounwind readnone willreturn
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
; Function Attrs: nounwind willreturn
declare void @llvm.assume(i1)
; Function Attrs: uwtable
-define hidden void @_Z6callerP1B(%class.B* %b) local_unnamed_addr {
+define hidden void @_Z6callerP1B(ptr %b) local_unnamed_addr {
entry:
- %0 = bitcast %class.B* %b to void (%class.B*)***
- %vtable = load void (%class.B*)**, void (%class.B*)*** %0, align 8, !tbaa !12, !invariant.group !15
- %1 = bitcast void (%class.B*)** %vtable to i8*
- %2 = tail call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1B")
+ %vtable = load ptr, ptr %b, align 8, !tbaa !12, !invariant.group !15
+ %0 = tail call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1B")
+ tail call void @llvm.assume(i1 %0)
+ %1 = load ptr, ptr %vtable, align 8, !invariant.load !15
+ tail call void %1(ptr %b)
+ %2 = tail call i1 @llvm.type.test(ptr nonnull %vtable, metadata !"_ZTS1A")
tail call void @llvm.assume(i1 %2)
- %3 = load void (%class.B*)*, void (%class.B*)** %vtable, align 8, !invariant.load !15
- tail call void %3(%class.B* %b)
- %4 = getelementptr %class.B, %class.B* %b, i64 0, i32 0
- %5 = bitcast void (%class.B*)** %vtable to i8*
- %6 = tail call i1 @llvm.type.test(i8* nonnull %5, metadata !"_ZTS1A")
- tail call void @llvm.assume(i1 %6)
- %7 = bitcast void (%class.B*)* %3 to void (%class.A*)*
- tail call void %7(%class.A* %4)
+ tail call void %1(ptr %b)
ret void
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
; CHECK-IR1-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, i32 %a) {
+define i32 @test(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was devirtualized.
; CHECK-IR1: %call = tail call i32 @_ZN1A1nEi
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
ret i32 %call
}
; Check that the call was devirtualized.
; CHECK-IR2: %call4 = tail call i32 @_ZN1A1nEi
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
attributes #0 = { noinline optnone }
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
-@_ZTV1A = linkonce_odr unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (void ()* @__cxa_pure_virtual to i8*), i8* bitcast (void ()* @__cxa_pure_virtual to i8*)] }, !type !0, !vcall_visibility !2
-@_ZTV1B = linkonce_odr unnamed_addr constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1, !vcall_visibility !2
+@_ZTV1A = linkonce_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @__cxa_pure_virtual, ptr @__cxa_pure_virtual] }, !type !0, !vcall_visibility !2
+@_ZTV1B = linkonce_odr unnamed_addr constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1, !vcall_visibility !2
;; Prevent the vtables from being dead code eliminated.
-@llvm.used = appending global [2 x i8*] [ i8* bitcast ( { [4 x i8*] }* @_ZTV1A to i8*), i8* bitcast ( { [4 x i8*] }* @_ZTV1B to i8*)]
+@llvm.used = appending global [2 x ptr] [ ptr @_ZTV1A, ptr @_ZTV1B]
; CHECK-IR-LABEL: define dso_local i32 @_start
-define i32 @_start(%struct.A* %obj, i32 %a) {
+define i32 @_start(ptr %obj, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
;; Check that the call was devirtualized.
; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
; CHECK-NODEVIRT-IR: %call = tail call i32 %fptr1
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
ret i32 %call
}
; CHECK-IR-LABEL: ret i32
; CHECK-IR-NEXT: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
declare void @__cxa_pure_virtual() unnamed_addr
-define linkonce_odr i32 @_ZN1A1fEi(%struct.A* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1A1fEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define linkonce_odr i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0
}
-define linkonce_odr i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define linkonce_odr i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-%struct.A = type { i32 (...)** }
+%struct.A = type { ptr }
%struct.B = type { %struct.A }
%struct.C = type { %struct.A }
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1, !vcall_visibility !5
-@_ZTV1C = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.C*, i32)* @_ZN1C1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !2, !vcall_visibility !5
-@_ZTV1D = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3, !vcall_visibility !5
+@_ZTV1B = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1B1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !1, !vcall_visibility !5
+@_ZTV1C = constant { [4 x ptr] } { [4 x ptr] [ptr null, ptr undef, ptr @_ZN1C1fEi, ptr @_ZN1A1nEi] }, !type !0, !type !2, !vcall_visibility !5
+@_ZTV1D = constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3, !vcall_visibility !5
; CHECK-IR-LABEL: define i32 @test
-define i32 @test(%struct.A* %obj, %struct.D* %obj2, i32 %a) {
+define i32 @test(ptr %obj, ptr %obj2, i32 %a) {
entry:
- %0 = bitcast %struct.A* %obj to i8***
- %vtable = load i8**, i8*** %0
- %1 = bitcast i8** %vtable to i8*
- %p = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1A")
+ %vtable = load ptr, ptr %obj
+ %p = call i1 @llvm.type.test(ptr %vtable, metadata !"_ZTS1A")
call void @llvm.assume(i1 %p)
- %fptrptr = getelementptr i8*, i8** %vtable, i32 1
- %2 = bitcast i8** %fptrptr to i32 (%struct.A*, i32)**
- %fptr1 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %2, align 8
+ %fptrptr = getelementptr ptr, ptr %vtable, i32 1
+ %fptr1 = load ptr, ptr %fptrptr, align 8
; Check that the call was devirtualized.
; CHECK-IR: %call = tail call i32 @_ZN1A1nEi
- %call = tail call i32 %fptr1(%struct.A* nonnull %obj, i32 %a)
+ %call = tail call i32 %fptr1(ptr nonnull %obj, i32 %a)
- %3 = bitcast i8** %vtable to i32 (%struct.A*, i32)**
- %fptr22 = load i32 (%struct.A*, i32)*, i32 (%struct.A*, i32)** %3, align 8
+ %fptr22 = load ptr, ptr %vtable, align 8
; We still have to call it as virtual.
; CHECK-IR: %call3 = tail call i32 %fptr22
- %call3 = tail call i32 %fptr22(%struct.A* nonnull %obj, i32 %call)
+ %call3 = tail call i32 %fptr22(ptr nonnull %obj, i32 %call)
- %4 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %4
- %5 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %5, metadata !4)
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
call void @llvm.assume(i1 %p2)
- %6 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %6, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was devirtualized.
; CHECK-IR: %call4 = tail call i32 @_ZN1D1mEi
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 %call3)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 %call3)
ret i32 %call4
}
; CHECK-IR-LABEL: ret i32
; CHECK-IR-LABEL: }
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 {
+define i32 @_ZN1B1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 {
+define i32 @_ZN1A1nEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1C1fEi(%struct.C* %this, i32 %a) #0 {
+define i32 @_ZN1C1fEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
-define i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 {
+define i32 @_ZN1D1mEi(ptr %this, i32 %a) #0 {
ret i32 0;
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-scei-ps4"
-%class.C = type <{ i32 (...)**, %class.A, %struct.CFVS, [6 x i8] }>
+%class.C = type <{ ptr, %class.A, %struct.CFVS, [6 x i8] }>
%class.A = type { %struct.Vec }
%struct.Vec = type { i8 }
%struct.CFVS = type { %struct.Vec }
%struct.S = type { i8 }
-define void @_ZN1CD2Ev(%class.C* %this) unnamed_addr align 2 {
+define void @_ZN1CD2Ev(ptr %this) unnamed_addr align 2 {
entry:
- %this.addr = alloca %class.C*, align 8
- %this1 = load %class.C*, %class.C** %this.addr, align 8
- %m = getelementptr inbounds %class.C, %class.C* %this1, i32 0, i32 2
- call void @_ZN4CFVSD1Ev(%struct.CFVS* %m), !dbg !50
- call void @_ZN4CFVSD2Ev(%struct.CFVS* %m), !dbg !50
+ %this.addr = alloca ptr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ %m = getelementptr inbounds %class.C, ptr %this1, i32 0, i32 2
+ call void @_ZN4CFVSD1Ev(ptr %m), !dbg !50
+ call void @_ZN4CFVSD2Ev(ptr %m), !dbg !50
ret void
}
-declare void @_ZN4CFVSD1Ev(%struct.CFVS*) unnamed_addr
-declare void @_ZN4CFVSD2Ev(%struct.CFVS*) unnamed_addr
+declare void @_ZN4CFVSD1Ev(ptr) unnamed_addr
+declare void @_ZN4CFVSD2Ev(ptr) unnamed_addr
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-scei-ps4"
-%class.C = type <{ i32 (...)**, %class.A, %struct.CFVS, [6 x i8] }>
+%class.C = type <{ ptr, %class.A, %struct.CFVS, [6 x i8] }>
%class.A = type { %struct.Vec }
%struct.Vec = type { i8 }
%struct.CFVS = type { %struct.Vec }
%struct.S = type { i8 }
-define void @_ZN1CD2Ev(%class.C* %this) unnamed_addr align 2 !dbg !8 {
+define void @_ZN1CD2Ev(ptr %this) unnamed_addr align 2 !dbg !8 {
entry:
- %this.addr = alloca %class.C*, align 8
- %this1 = load %class.C*, %class.C** %this.addr, align 8
- %m = getelementptr inbounds %class.C, %class.C* %this1, i32 0, i32 2
- call void @_ZN4CFVSD2Ev(%struct.CFVS* %m), !dbg !50
+ %this.addr = alloca ptr, align 8
+ %this1 = load ptr, ptr %this.addr, align 8
+ %m = getelementptr inbounds %class.C, ptr %this1, i32 0, i32 2
+ call void @_ZN4CFVSD2Ev(ptr %m), !dbg !50
ret void
}
-declare void @_ZN4CFVSD2Ev(%struct.CFVS*) unnamed_addr
+declare void @_ZN4CFVSD2Ev(ptr) unnamed_addr
-declare dereferenceable(1) %struct.S* @_Z3Getv()
+declare dereferenceable(1) ptr @_Z3Getv()
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5, !6}
!16 = !DIFile(filename: "./bz188598.h", directory: ".")
!17 = !{!55}
!22 = !{!23}
-!23 = !DITemplateValueParameter(name: "F", type: !24, value: %struct.S* ()* @_Z3Getv)
+!23 = !DITemplateValueParameter(name: "F", type: !24, value: ptr @_Z3Getv)
!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !25, size: 64)
!25 = !DIDerivedType(tag: DW_TAG_typedef, name: "Func", file: !16, line: 2, baseType: !26)
!26 = !DISubroutineType(types: !27)
@A = external global i32
define i32 @main() {
- %v = load i32, i32* @A
+ %v = load i32, ptr @A
ret i32 %v
}
; Function Attrs: nounwind uwtable
define i32 @main() local_unnamed_addr {
%1 = tail call i32 (...) @foo()
- %2 = load i32, i32* @A, align 4
+ %2 = load i32, ptr @A, align 4
%3 = add nsw i32 %2, %1
ret i32 %3
}
-@main_alias = weak_odr alias i32 (), i32 ()* @main
+@main_alias = weak_odr alias i32 (), ptr @main
declare i32 @foo(...) local_unnamed_addr
define internal void @staticfunc() #0 {
entry:
- %0 = load i32, i32* @staticvar, align 4
+ %0 = load i32, ptr @staticvar, align 4
ret void
}
declare i32 @__gxx_personality_v0(...)
-define void @cleanupret() personality i32 (...)* @__gxx_personality_v0 {
+define void @cleanupret() personality ptr @__gxx_personality_v0 {
entry:
invoke void @nonThrowing()
to label %exit unwind label %pad
ret void
}
-define void @catchret() personality i32 (...)* @__gxx_personality_v0 {
+define void @catchret() personality ptr @__gxx_personality_v0 {
entry:
invoke void @nonThrowing()
to label %exit unwind label %pad
ret void
}
-define void @resume() uwtable optsize ssp personality i32 (...)* @__gxx_personality_v0 {
+define void @resume() uwtable optsize ssp personality ptr @__gxx_personality_v0 {
entry:
invoke void @nonThrowing()
to label %try.cont unwind label %lpad
ret void
lpad: ; preds = %entry
- %exn = landingpad {i8*, i32}
+ %exn = landingpad {ptr, i32}
cleanup
- resume { i8*, i32 } %exn
+ resume { ptr, i32 } %exn
}
-define void @cleanupret_nounwind() #0 personality i32 (...)* @__gxx_personality_v0 {
+define void @cleanupret_nounwind() #0 personality ptr @__gxx_personality_v0 {
entry:
invoke void @nonThrowing()
to label %exit unwind label %pad
; CHECK-NOT: ; Function Attrs:
; CHECK: define i32 @indirect(ptr nocapture %0) {
-define i32 @indirect(i32 ()* nocapture) {
+define i32 @indirect(ptr nocapture) {
%2 = tail call i32 %0()
ret i32 %2
}
; CHECK-NOT: ; Function Attrs:
; CHECK: define ptr @inlineasm() {
-define i8* @inlineasm() {
+define ptr @inlineasm() {
entry:
- %0 = tail call i8* asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
- ret i8* %0
+ %0 = tail call ptr asm sideeffect "lea ff_h264_cabac_tables(%rip), $0", "=&r,~{dirflag},~{fpsr},~{flags}"()
+ ret ptr %0
}
; CHECK-NOT: ; Function Attrs:
; CHECK: define void @selectcallee() {
define void @selectcallee() {
; Test calls that aren't handled either as direct or indirect.
- call void select (i1 icmp eq (i32* @global, i32* null), void ()* @f, void ()* @g)()
+ call void select (i1 icmp eq (ptr @global, ptr null), ptr @f, ptr @g)()
ret void
}
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
-define float @globalfunc1(i32*, float*) {
- %3 = load i32, i32* %0, align 4, !tbaa !0
+define float @globalfunc1(ptr, ptr) {
+ %3 = load i32, ptr %0, align 4, !tbaa !0
%4 = sitofp i32 %3 to float
- %5 = load float, float* %1, align 4, !tbaa !4
+ %5 = load float, ptr %1, align 4, !tbaa !4
%6 = fadd float %4, %5
ret float %6
}
; We need a second function for force the metadata to be emitted in the global block
-define float @globalfunc2(i32*, float*) {
- %3 = load i32, i32* %0, align 4, !tbaa !0
+define float @globalfunc2(ptr, ptr) {
+ %3 = load i32, ptr %0, align 4, !tbaa !0
%4 = sitofp i32 %3 to float
- %5 = load float, float* %1, align 4, !tbaa !4
+ %5 = load float, ptr %1, align 4, !tbaa !4
%6 = fadd float %4, %5
ret float %6
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-declare dso_local [1 x i8*]* @foo();
-declare dso_local [1 x i8*]* @bar();
+declare dso_local ptr @foo();
+declare dso_local ptr @bar();
define dso_local i32 @main() {
- %p1 = call [1 x i8*]* @foo()
- %p2 = call [1 x i8*]* @bar()
- %v1 = ptrtoint [1 x i8*]* %p1 to i32
- %v2 = ptrtoint [1 x i8*]* %p2 to i32
+ %p1 = call ptr @foo()
+ %p2 = call ptr @bar()
+ %v1 = ptrtoint ptr %p1 to i32
+ %v2 = ptrtoint ptr %p2 to i32
%v3 = add i32 %v1, %v2
ret i32 %v3
}
; from, to test handling of a global variable with an entry in the distributed
; index but not with a copy in the source module (since we can't import
; appending linkage globals).
-@llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer
+@llvm.global_ctors = appending global [0 x { i32, ptr, ptr }] zeroinitializer
define i64 @H() {
call i64 @G()
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.S = type { i32, i32, i32* }
+%struct.S = type { i32, i32, ptr }
define dso_local i32 @main() local_unnamed_addr {
entry:
- %call = tail call %struct.S* @_Z6getObjv()
- %d = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 0
- %0 = load i32, i32* %d, align 8
- %v = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 1
- %1 = load i32, i32* %v, align 4
+ %call = tail call ptr @_Z6getObjv()
+ %0 = load i32, ptr %call, align 8
+ %v = getelementptr inbounds %struct.S, ptr %call, i64 0, i32 1
+ %1 = load i32, ptr %v, align 4
%add = add nsw i32 %1, %0
ret i32 %add
}
-declare dso_local %struct.S* @_Z6getObjv() local_unnamed_addr
+declare dso_local ptr @_Z6getObjv() local_unnamed_addr
@g = external global i32
define i32 @main() {
- %v = load i32, i32* @g
+ %v = load i32, ptr @g
ret i32 %v
}
@g = external global i32
define i32 @main() {
- %v = load i32, i32* @g
+ %v = load i32, ptr @g
ret i32 %v
}
-define i32* @ret_ptr() {
- ret i32* @g.alias
+define ptr @ret_ptr() {
+ ret ptr @g.alias
}
}
define i32 @foo() {
- %v = load i32, i32* @g
+ %v = load i32, ptr @g
ret i32 %v
}
target triple = "x86_64-unknown-linux-gnu"
@a = external global i32
-@b = external global i32*
+@b = external global ptr
define i32 @main() {
- %p = load i32*, i32** @b, align 8
- store i32 33, i32* %p, align 4
- %v = load i32, i32* @a, align 4
+ %p = load ptr, ptr @b, align 8
+ store i32 33, ptr %p, align 4
+ %v = load i32, ptr @a, align 4
ret i32 %v
}
; RUN: llvm-dis < %t6.0.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_SRC
; RUN: llvm-dis < %t6.1.3.imported.bc | FileCheck %s --check-prefix=OLDAPI_DST_DSO
-; OLDAPI_SRC: @b = internal global i32* @a, align 8
+; OLDAPI_SRC: @b = internal global ptr @a, align 8
; OLDAPI_SRC-NEXT: @a = dso_local global i32 42, align 4
-; OLDAPI_DST: @b = external dso_local global i32*
+; OLDAPI_DST: @b = external dso_local global ptr
; OLDAPI_DST-NEXT: @a = available_externally dso_local global i32 42, align 4
-; OLDAPI_DST_DSO: @b = external global i32*
+; OLDAPI_DST_DSO: @b = external global ptr
; OLDAPI_DST_DSO-NEXT: @a = available_externally global i32 42, align 4
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@a = external global i32
-@b = external global i32*
+@b = external global ptr
define i32 @main() {
- %p = load i32*, i32** @b, align 8
- store i32 33, i32* %p, align 4
- %v = load i32, i32* @a, align 4
+ %p = load ptr, ptr @b, align 8
+ store i32 33, ptr %p, align 4
+ %v = load i32, ptr @a, align 4
ret i32 %v
}
declare i32 @foo()
@g2 = external global i32
-@llvm.used = appending global [1 x i32*] [i32* @g2]
+@llvm.used = appending global [1 x ptr] [ptr @g2]
define i32 @main() {
%v = call i32 @foo()
@gDead = internal unnamed_addr global i32 1, align 4
define i32 @main() local_unnamed_addr {
- %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)()
- %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)()
+ %call = tail call i32 @foo()
+ %call1 = tail call i32 @bar()
%add = add nsw i32 %call1, %call
ret i32 %add
}
@gBar = external global i32
define i32 @main() local_unnamed_addr {
- %call = tail call i32 bitcast (i32 (...)* @foo to i32 ()*)()
- %call1 = tail call i32 bitcast (i32 (...)* @bar to i32 ()*)()
+ %call = tail call i32 @foo()
+ %call1 = tail call i32 @bar()
%add = add nsw i32 %call1, %call
ret i32 %add
}
; Make @weak_func_nonprevailing an aliasee to ensure it is still marked
; live and kept as a definition even when non-prevailing. We want to ensure
; this definition is not internalized.
-@alias1 = hidden alias void (), void ()* @weak_func_nonprevailing
+@alias1 = hidden alias void (), ptr @weak_func_nonprevailing
define weak void @weak_func_nonprevailing() {
ret void
}
target triple = "x86_64-apple-macosx10.11.0"
define void @globalfunc1(i32 %arg) {
- %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
+ %x = call i1 @llvm.type.test(ptr undef, metadata !"typeid1")
%tmp = add i32 %arg, 0, !metadata !2
ret void
}
; These function are not imported and so we don't want to load their metadata.
define void @globalfunc2(i32 %arg) {
- %x = call i1 @llvm.type.test(i8* undef, metadata !"typeid1")
+ %x = call i1 @llvm.type.test(ptr undef, metadata !"typeid1")
%tmp = add i32 %arg, 0, !metadata !1
ret void
}
ret void
}
-declare i1 @llvm.type.test(i8* %ptr, metadata %bitset) nounwind readnone
+declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone
!1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
!2 = !{!"Hello World"}
target triple = "x86_64-grtev4-linux-gnu"
$baz.clone = comdat any
-@baz = weak alias void (), void ()* @baz.clone
+@baz = weak alias void (), ptr @baz.clone
define void @foo() #5 align 2 {
tail call void @baz.clone()
; from second module is preempted and converted to available_externally and
; removed from comdat.
; IMPORT1: @g_private = private global i32 43, comdat($g)
-; IMPORT1: define weak_odr i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] comdat {
+; IMPORT1: define weak_odr i32 @f(ptr %0) unnamed_addr [[ATTR:#[0-9]+]] comdat {
; IMPORT1: define weak_odr i32 @g() unnamed_addr [[ATTR]] comdat {
; IMPORT1: define internal void @g_internal() unnamed_addr comdat($g) {
; IMPORT2: @g_private = available_externally dso_local global i32 41{{$}}
-; IMPORT2: define available_externally i32 @f(i8* %0) unnamed_addr [[ATTR:#[0-9]+]] {
+; IMPORT2: define available_externally i32 @f(ptr %0) unnamed_addr [[ATTR:#[0-9]+]] {
; IMPORT2: define available_externally i32 @g() unnamed_addr [[ATTR]] {
; IMPORT2: define available_externally dso_local void @g_internal() unnamed_addr {
@g_private = private global i32 43, comdat($g)
-define linkonce_odr i32 @f(i8*) unnamed_addr comdat {
+define linkonce_odr i32 @f(ptr) unnamed_addr comdat {
ret i32 43
}
define internal void @_ZN12_GLOBAL__N_16Module4dumpEv() {
ret void
}
-@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ZN12_GLOBAL__N_16Module4dumpEv to i8*)], section "llvm.metadata"
+@llvm.used = appending global [1 x ptr] [ptr @_ZN12_GLOBAL__N_16Module4dumpEv], section "llvm.metadata"
define void @globalfunc() #0 {
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.S = type { %struct.Derived* }
+%struct.S = type { ptr }
%struct.Derived = type { i32 }
%struct.Base = type { i32 }
@obj = dso_local local_unnamed_addr global %struct.S zeroinitializer, align 8
-define dso_local %struct.Base* @foo() local_unnamed_addr {
+define dso_local ptr @foo() local_unnamed_addr {
entry:
- %0 = load %struct.Base*, %struct.Base** bitcast (%struct.S* @obj to %struct.Base**), align 8
- store %struct.Base* null, %struct.Base** bitcast (%struct.S* @obj to %struct.Base**), align 8
- ret %struct.Base* %0
+ %0 = load ptr, ptr @obj, align 8
+ store ptr null, ptr @obj, align 8
+ ret ptr %0
}
; CHECK: ^0 = module:
define i32 @main() {
entry:
%retval = alloca i32, align 4
- store i32 0, i32* %retval, align 4
+ store i32 0, ptr %retval, align 4
%call = call i32 (...) @b()
ret i32 %call
}
@b = internal global i32 1, align 4
@x = internal global i32 1, align 4
-@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @b to i8*)], section "llvm.metadata"
-@llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @x to i8*)], section "llvm.metadata"
+@llvm.compiler.used = appending global [1 x ptr] [ptr @b], section "llvm.metadata"
+@llvm.used = appending global [1 x ptr] [ptr @x], section "llvm.metadata"
module asm "\09.text"
module asm "\09.type\09foo,@function"
}
define i32 @func2() #1 {
- %1 = load i32, i32* @b, align 4
+ %1 = load i32, ptr @b, align 4
ret i32 %1
}
define i32 @func3() #1 {
- %1 = load i32, i32* @x, align 4
+ %1 = load i32, ptr @x, align 4
ret i32 %1
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"
-@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @g, i8* null }]
+@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @g, ptr null }]
-%struct.D = type { i32 (...)** }
+%struct.D = type { ptr }
-@_ZTV1D = internal constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3
+@_ZTV1D = internal constant { [3 x ptr] } { [3 x ptr] [ptr null, ptr undef, ptr @_ZN1D1mEi] }, !type !3
; CHECK-IR-LABEL: define weak_odr dso_local i32 @test
-define weak_odr i32 @test(%struct.D* %obj2, i32 %a) {
+define weak_odr i32 @test(ptr %obj2, i32 %a) {
entry:
- %0 = bitcast %struct.D* %obj2 to i8***
- %vtable2 = load i8**, i8*** %0
- %1 = bitcast i8** %vtable2 to i8*
- %p2 = call i1 @llvm.type.test(i8* %1, metadata !4)
+ %vtable2 = load ptr, ptr %obj2
+ %p2 = call i1 @llvm.type.test(ptr %vtable2, metadata !4)
call void @llvm.assume(i1 %p2)
- %2 = bitcast i8** %vtable2 to i32 (%struct.D*, i32)**
- %fptr33 = load i32 (%struct.D*, i32)*, i32 (%struct.D*, i32)** %2, align 8
+ %fptr33 = load ptr, ptr %vtable2, align 8
; Check that the call was not devirtualized.
; CHECK-IR: %call4 = tail call i32 %fptr33
- %call4 = tail call i32 %fptr33(%struct.D* nonnull %obj2, i32 0)
+ %call4 = tail call i32 %fptr33(ptr nonnull %obj2, i32 0)
ret i32 %call4
}
; CHECK-IR-LABEL: ret i32
; CHECK-IR-LABEL: }
; Function Attrs: inlinehint nounwind uwtable
-define internal void @_ZN1DC2Ev(%struct.D* %this) unnamed_addr align 2 {
+define internal void @_ZN1DC2Ev(ptr %this) unnamed_addr align 2 {
entry:
- %this.addr = alloca %struct.D*, align 8
- store %struct.D* %this, %struct.D** %this.addr, align 8
- %this1 = load %struct.D*, %struct.D** %this.addr
- %0 = bitcast %struct.D* %this1 to i32 (...)***
- store i32 (...)** bitcast (i8** getelementptr inbounds ({ [3 x i8*] }, { [3 x i8*] }* @_ZTV1D, i64 0, inrange i32 0, i64 2) to i32 (...)**), i32 (...)*** %0, align 8
+ %this.addr = alloca ptr, align 8
+ store ptr %this, ptr %this.addr, align 8
+ %this1 = load ptr, ptr %this.addr
+ store ptr getelementptr inbounds ({ [3 x ptr] }, ptr @_ZTV1D, i64 0, inrange i32 0, i64 2), ptr %this1, align 8
ret void
}
define internal void @g() section ".text.startup" {
%d = alloca %struct.D, align 8
- call void @_ZN1DC2Ev(%struct.D* %d)
+ call void @_ZN1DC2Ev(ptr %d)
ret void
}
-declare i1 @llvm.type.test(i8*, metadata)
+declare i1 @llvm.type.test(ptr, metadata)
declare void @llvm.assume(i1)
-declare i32 @_ZN1D1mEi(%struct.D* %this, i32 %a)
+declare i32 @_ZN1D1mEi(ptr %this, i32 %a)
!3 = !{i64 16, !4}
!4 = distinct !{}
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: nounwind ssp uwtable
-define i32 @main(i32, i8** nocapture readnone) local_unnamed_addr #0 {
+define i32 @main(i32, ptr nocapture readnone) local_unnamed_addr #0 {
%3 = tail call i32 @foo(i32 %0) #0
ret i32 %3
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
-declare protected i32 @personality_routine(i32, i32, i64, i8*, i8*)
-declare protected i32 @personality_routine2(i32, i32, i64, i8*, i8*)
-declare protected i32 @personality_routine3(i32, i32, i64, i8*, i8*)
+declare protected i32 @personality_routine(i32, i32, i64, ptr, ptr)
+declare protected i32 @personality_routine2(i32, i32, i64, ptr, ptr)
+declare protected i32 @personality_routine3(i32, i32, i64, ptr, ptr)
declare void @bar()
-define void @foo() personality i32 (i32, i32, i64, i8*, i8*)* @personality_routine {
+define void @foo() personality ptr @personality_routine {
ret void
}
-define internal void @foo2b() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine2 to i8*) {
+define internal void @foo2b() personality ptr @personality_routine2 {
ret void
}
-define internal void @foo2a() prologue void ()* @foo2b {
+define internal void @foo2a() prologue ptr @foo2b {
ret void
}
-define void @foo2() prefix void ()* @foo2a {
+define void @foo2() prefix ptr @foo2a {
ret void
}
-define void @foo3() personality i8* bitcast (i32 (i32, i32, i64, i8*, i8*)* @personality_routine3 to i8*) {
+define void @foo3() personality ptr @personality_routine3 {
ret void
}
define void @_Z5Bravov() !dbg !7 {
%Hotel = alloca %struct.Delta, align 4
%India = alloca %struct.Echo, align 4
- call void @llvm.dbg.declare(metadata %struct.Delta* %Hotel, metadata !10, metadata !DIExpression()), !dbg !22
- call void @_ZN4EchoD2Ev(%struct.Echo* %India), !dbg !28
+ call void @llvm.dbg.declare(metadata ptr %Hotel, metadata !10, metadata !DIExpression()), !dbg !22
+ call void @_ZN4EchoD2Ev(ptr %India), !dbg !28
ret void, !dbg !28
}
declare void @llvm.dbg.declare(metadata, metadata, metadata)
-define linkonce_odr void @_ZN4EchoD2Ev(%struct.Echo* %this) unnamed_addr comdat align 2 {
- %this.addr.i = alloca %struct.Charlie*, align 8
- call void @llvm.dbg.declare(metadata %struct.Charlie** %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !32
- %this1.i = load %struct.Charlie*, %struct.Charlie** %this.addr.i, align 8
- %Golf.i = getelementptr inbounds %struct.Charlie, %struct.Charlie* %this1.i, i32 0, i32 0, !dbg !33
+define linkonce_odr void @_ZN4EchoD2Ev(ptr %this) unnamed_addr comdat align 2 {
+ %this.addr.i = alloca ptr, align 8
+ call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !32
+ %this1.i = load ptr, ptr %this.addr.i, align 8
ret void
}
-define linkonce_odr void @_ZN5DeltaD2Ev(%struct.Delta* %this) unnamed_addr comdat align 2 !dbg !36 {
- %this.addr.i = alloca %struct.Charlie*, align 8
- call void @llvm.dbg.declare(metadata %struct.Charlie** %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !41
- %this1.i = load %struct.Charlie*, %struct.Charlie** %this.addr.i, align 8
- %Golf.i = getelementptr inbounds %struct.Charlie, %struct.Charlie* %this1.i, i32 0, i32 0, !dbg !48
+define linkonce_odr void @_ZN5DeltaD2Ev(ptr %this) unnamed_addr comdat align 2 !dbg !36 {
+ %this.addr.i = alloca ptr, align 8
+ call void @llvm.dbg.declare(metadata ptr %this.addr.i, metadata !29, metadata !DIExpression()), !dbg !41
+ %this1.i = load ptr, ptr %this.addr.i, align 8
ret void
}
define i32 @main() {
entry:
%retval = alloca i32, align 4
- store i32 0, i32* %retval, align 4
+ store i32 0, ptr %retval, align 4
%call = call i32 (...) @b()
ret i32 %call
}
; RUN: llvm-dis < %t.o.1.2.internalize.bc | FileCheck %s --check-prefix=PROMOTE
; PROMOTE: @a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
@a = private global i8 0, section "__TEXT,__cstring,cstring_literals"
-@b = global i8 *@a
+@b = global ptr@a
; We want foo to be imported in the main module!
; RUN: llvm-dis < %t.o.2.3.import.bc | FileCheck %s --check-prefix=IMPORT
; IMPORT: define available_externally dso_local ptr @foo()
-define i8 **@foo() {
- ret i8 **@b
+define ptr@foo() {
+ ret ptr@b
}
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
-%struct.S = type { i32, i32, i32* }
+%struct.S = type { i32, i32, ptr }
define dso_local i32 @main() local_unnamed_addr {
entry:
- %call = tail call %struct.S* @_Z6getObjv()
- %d = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 0
- %0 = load i32, i32* %d, align 8
- %v = getelementptr inbounds %struct.S, %struct.S* %call, i64 0, i32 1
- %1 = load i32, i32* %v, align 4
+ %call = tail call ptr @_Z6getObjv()
+ %0 = load i32, ptr %call, align 8
+ %v = getelementptr inbounds %struct.S, ptr %call, i64 0, i32 1
+ %1 = load i32, ptr %v, align 4
%add = add nsw i32 %1, %0
ret i32 %add
}
-declare dso_local %struct.S* @_Z6getObjv() local_unnamed_addr
+declare dso_local ptr @_Z6getObjv() local_unnamed_addr
; CHECK: define hidden void @foo.llvm.123()
define hidden void @foo.llvm.123() {
- %1 = getelementptr inbounds [10 x i8], [10 x i8]* @switch.table.foo.llvm.123, i64 0, i64 0
- store i8 1, i8* %1, align 8
+ store i8 1, ptr @switch.table.foo.llvm.123, align 8
ret void
}
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.15.0"
-@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @foo to i8*)], section "llvm.metadata"
+@llvm.used = appending global [1 x ptr] [ptr @foo], section "llvm.metadata"
; Make sure foo is not internalized.
; CHECK: define i32 @foo()
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.11.0"
-declare i32 @fprintf(%FILE*, i8*, ...)
+declare i32 @fprintf(ptr, ptr, ...)
%FILE = type { }
; Check fprintf(fp, "%s", str) -> fwrite(str, fp) only when builtins are enabled
-define void @foo(%FILE* %fp) {
- %fmt = getelementptr [3 x i8], [3 x i8]* @percent_s, i32 0, i32 0
- %str = getelementptr [13 x i8], [13 x i8]* @hello_world, i32 0, i32 0
- call i32 (%FILE*, i8*, ...) @fprintf(%FILE* %fp, i8* %fmt, i8* %str)
+define void @foo(ptr %fp) {
+ call i32 (ptr, ptr, ...) @fprintf(ptr %fp, ptr @percent_s, ptr @hello_world)
ret void
}
@var1 = weak global i32 1, align 4
@var2 = extern_weak global i32
-declare void @ext(void ()*)
+declare void @ext(ptr)
; CHECK: declare hidden i32 @hidden_def_weak_def()
; CHECK: declare protected void @protected_def_weak_def()
define weak i32 @hidden_def_weak_def() {
entry:
- %0 = load i32, i32* @var2
+ %0 = load i32, ptr @var2
ret i32 %0
}
define i32 @main() {
entry:
- call void @ext(void ()* bitcast (i32 ()* @hidden_def_weak_def to void ()*))
- call void @ext(void ()* @protected_def_weak_def)
- call void @ext(void ()* @protected_def_weak_hidden_def)
- call void @ext(void ()* @hidden_def_ref)
- call void @ext(void ()* @hidden_def_weak_ref)
- call void @ext(void ()* @protected_def_hidden_ref)
- call void @ext(void ()* @not_imported)
+ call void @ext(ptr @hidden_def_weak_def)
+ call void @ext(ptr @protected_def_weak_def)
+ call void @ext(ptr @protected_def_weak_hidden_def)
+ call void @ext(ptr @hidden_def_ref)
+ call void @ext(ptr @hidden_def_weak_ref)
+ call void @ext(ptr @protected_def_hidden_ref)
+ call void @ext(ptr @not_imported)
;; Calls ensure the functions are imported.
call i32 @hidden_def_weak_def()
define hidden i32 @hidden_def_weak_def() {
entry:
- %0 = load i32, i32* @var1
+ %0 = load i32, ptr @var1
ret i32 %0
}
@var1 = weak global i32 1, align 4
@var2 = extern_weak global i32
-declare void @ext(void ()*)
+declare void @ext(ptr)
; CHECK: declare hidden i32 @hidden_def_weak_def()
;; Currently the visibility is not propagated onto an unimported function,
define weak i32 @hidden_def_weak_def() {
entry:
- %0 = load i32, i32* @var2
+ %0 = load i32, ptr @var2
ret i32 %0
}
define i32 @main() {
entry:
- call void @ext(void ()* bitcast (i32 ()* @hidden_def_weak_def to void ()*))
- call void @ext(void ()* @hidden_def_ref)
- call void @ext(void ()* @hidden_def_weak_ref)
- call void @ext(void ()* @not_imported)
+ call void @ext(ptr @hidden_def_weak_def)
+ call void @ext(ptr @hidden_def_ref)
+ call void @ext(ptr @hidden_def_weak_ref)
+ call void @ext(ptr @not_imported)
;; Calls ensure the functions are imported.
call i32 @hidden_def_weak_def()
define hidden i32 @hidden_def_weak_def() {
entry:
- %0 = load i32, i32* @var1
+ %0 = load i32, ptr @var1
ret i32 %0
}
@_ZZN9SingletonI1SE11getInstanceEvE8instance = linkonce_odr dso_local global %struct.S zeroinitializer, comdat, align 8
-@_ZZN9SingletonI1SE11getInstanceEvE13instance_weak = weak_odr dso_local global %struct.S* null, comdat, align 8
+@_ZZN9SingletonI1SE11getInstanceEvE13instance_weak = weak_odr dso_local global ptr null, comdat, align 8
define dso_local void @_ZL5initSv() {
- %1 = call dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv()
- store %struct.S* %1, %struct.S** @_ZZN9SingletonI1SE11getInstanceEvE13instance_weak
- %2 = getelementptr inbounds %struct.S, %struct.S* %1, i32 0, i32 0
- store i64 1, i64* %2, align 8
+ %1 = call dereferenceable(16) ptr @_ZN9SingletonI1SE11getInstanceEv()
+ store ptr %1, ptr @_ZZN9SingletonI1SE11getInstanceEvE13instance_weak
+ store i64 1, ptr %1, align 8
ret void
}
-define linkonce_odr dso_local dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv() #0 comdat align 2 {
- ret %struct.S* @_ZZN9SingletonI1SE11getInstanceEvE8instance
+define linkonce_odr dso_local dereferenceable(16) ptr @_ZN9SingletonI1SE11getInstanceEv() #0 comdat align 2 {
+ ret ptr @_ZZN9SingletonI1SE11getInstanceEvE8instance
}
target triple = "x86_64-apple-macosx10.11.0"
; Alias are resolved, but can't be turned into "available_externally"
-; MOD1: @linkonceodralias = weak_odr alias void (), void ()* @linkonceodrfuncwithalias
-; MOD2: @linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
-@linkonceodralias = linkonce_odr alias void (), void ()* @linkonceodrfuncwithalias
+; MOD1: @linkonceodralias = weak_odr alias void (), ptr @linkonceodrfuncwithalias
+; MOD2: @linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
+@linkonceodralias = linkonce_odr alias void (), ptr @linkonceodrfuncwithalias
; Alias are resolved, but can't be turned into "available_externally"
-; MOD1: @linkoncealias = weak alias void (), void ()* @linkoncefuncwithalias
-; MOD2: @linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
-@linkoncealias = linkonce alias void (), void ()* @linkoncefuncwithalias
+; MOD1: @linkoncealias = weak alias void (), ptr @linkoncefuncwithalias
+; MOD2: @linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
+@linkoncealias = linkonce alias void (), ptr @linkoncefuncwithalias
; Function with an alias are resolved to weak_odr in prevailing module, but
; not optimized in non-prevailing module (illegal to have an