Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp =================================================================== --- llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -214,14 +214,14 @@ if (!Ptr) { LLVM_DEBUG(dbgs() << "can't find pointer in vtable!\n"); VFESafeVTables.erase(VTable); - return; + continue; } auto Callee = dyn_cast(Ptr->stripPointerCasts()); if (!Callee) { LLVM_DEBUG(dbgs() << "vtable entry is not function pointer!\n"); VFESafeVTables.erase(VTable); - return; + continue; } LLVM_DEBUG(dbgs() << "vfunc dep " << Caller->getName() << " -> " Index: llvm/test/Transforms/GlobalDCE/virtual-functions-null.ll =================================================================== --- llvm/test/Transforms/GlobalDCE/virtual-functions-null.ll +++ llvm/test/Transforms/GlobalDCE/virtual-functions-null.ll @@ -20,7 +20,7 @@ ]}, align 8, !type !{i64 0, !"vfunc1.type"}, !type !{i64 8, !"vfunc2.type"}, !vcall_visibility !{i64 2} ; CHECK: @vtableB = internal unnamed_addr constant { [2 x i8*] } { [2 x i8*] [ -; CHECK-SAME: i8* null, +; CHECK-SAME: i8* bitcast (void ()* @vfunc1 to i8*), ; CHECK-SAME: i8* bitcast (void ()* @vfunc2 to i8*) ; CHECK-SAME: ] }, align 8