Skip to content

Commit 9ff4b28

Browse files
committed
fix issue with refcount
1 parent 6baf698 commit 9ff4b28

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

offload/libomptarget/OffloadRTL.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ void initRuntime() {
3232
if (PM == nullptr)
3333
PM = new PluginManager();
3434

35-
if (OffloadPolicy::isOffloadDisabled()) {
36-
DP("Offload is disabled. Skipping library initialization\n");
37-
// Do only absolutely needed initialization
38-
return;
39-
}
40-
4135
RefCount++;
4236
if (RefCount == 1) {
4337
DP("Init offload library!\n");
@@ -46,6 +40,10 @@ void initRuntime() {
4640
llvm::omp::target::ompt::connectLibrary();
4741
#endif
4842

43+
if (OffloadPolicy::isOffloadDisabled()) {
44+
DP("Offload is disabled. Skipping plugin initialization\n");
45+
return;
46+
}
4947
PM->init();
5048
PM->registerDelayedLibraries();
5149
}

0 commit comments

Comments
 (0)