Skip to content

Commit 8835067

Browse files
lwesiersigcbot
authored andcommitted
Fix protobuf
Fix protobuf
1 parent 705de1d commit 8835067

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

IGC/Metrics/IGCMetricImpl.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ namespace IGCMetrics
4646
}
4747
this->map_InstrLoc2Func.clear();
4848
this->map_Loops.clear();
49-
50-
// Optional: Delete all global objects allocated by libprotobuf.
51-
google::protobuf::ShutdownProtobufLibrary();
5249
#endif
5350
}
5451
bool IGCMetricImpl::Enable()
@@ -427,6 +424,13 @@ namespace IGCMetrics
427424
if (instr_call != nullptr)
428425
{
429426
auto calledFunc = instr_call->getCalledFunction();
427+
428+
if (calledFunc == nullptr)
429+
{
430+
// TODO: Handle function pointers
431+
continue;
432+
}
433+
430434
auto calledFuncName = calledFunc->getName();
431435
auto funcCallType = IGC_METRICS::FuncCalls_FuncCallsType::FuncCalls_FuncCallsType_INLINE;
432436

IGC/common/debug/Debug.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ using namespace llvm;
4545
#if defined _WIN32 || _WIN64
4646
//#if defined( _DEBUG )
4747
#include "psapi.h"
48+
49+
#ifdef IGC_METRICS__PROTOBUF_ATTACHED
50+
#include <google/protobuf/message_lite.h>
51+
#endif
52+
4853
int CatchAssert( int reportType, char *userMessage, int *retVal )
4954
{
5055
IGC_ASSERT(0);
@@ -78,6 +83,11 @@ BOOL WINAPI DllMain(
7883
switch(fdwReason) {
7984
case DLL_PROCESS_DETACH:
8085
llvm_shutdown();
86+
87+
#ifdef IGC_METRICS__PROTOBUF_ATTACHED
88+
// Optional: Delete all global objects allocated by libprotobuf.
89+
google::protobuf::ShutdownProtobufLibrary();
90+
#endif
8191
break;
8292

8393
case DLL_PROCESS_ATTACH:

0 commit comments

Comments
 (0)