PR19113: Emit 'vtable' TBAA metadata when loading a vptr in a pointer-to-member-function call.
llvm-svn: 203691
This commit is contained in:
parent
8cc04fc40d
commit
0fc7bdc821
|
@ -359,8 +359,7 @@ llvm::Value *ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
|
|||
|
||||
// Cast the adjusted this to a pointer to vtable pointer and load.
|
||||
llvm::Type *VTableTy = Builder.getInt8PtrTy();
|
||||
llvm::Value *VTable = Builder.CreateBitCast(This, VTableTy->getPointerTo());
|
||||
VTable = Builder.CreateLoad(VTable, "memptr.vtable");
|
||||
llvm::Value *VTable = CGF.GetVTablePtr(This, VTableTy);
|
||||
|
||||
// Apply the offset.
|
||||
llvm::Value *VTableOffset = FnAsInt;
|
||||
|
|
|
@ -17,12 +17,19 @@ void CreateA() {
|
|||
new A;
|
||||
}
|
||||
|
||||
void CallFoo(A *a) {
|
||||
void CallFoo(A *a, int (A::*fp)() const) {
|
||||
a->foo();
|
||||
(a->*fp)();
|
||||
}
|
||||
|
||||
// CHECK-LABEL: @_Z7CallFoo
|
||||
// CHECK: %{{.*}} = load {{.*}} !tbaa ![[NUM:[0-9]+]]
|
||||
// CHECK: br i1
|
||||
// CHECK: load {{.*}}, !tbaa ![[NUM]]
|
||||
//
|
||||
// CHECK-LABEL: @_ZN1AC2Ev
|
||||
// CHECK: store {{.*}} !tbaa ![[NUM]]
|
||||
//
|
||||
// CHECK: [[NUM]] = metadata !{metadata [[TYPE:!.*]], metadata [[TYPE]], i64 0}
|
||||
// CHECK: [[TYPE]] = metadata !{metadata !"vtable pointer", metadata !{{.*}}
|
||||
// NOTBAA-NOT: = metadata !{metadata !"Simple C/C++ TBAA"}
|
||||
|
|
Loading…
Reference in New Issue