mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-22 21:15:40 -04:00
[OPENMP] Do not create offloading entry for declare target variables
declarations. We should not create offloading entries for declare target var declarations as it causes compiler crash. llvm-svn: 340968
This commit is contained in:
parent
0e9a76dbe3
commit
b4dd6d24d7
@ -3989,6 +3989,9 @@ void CGOpenMPRuntime::createOffloadEntriesAndInfoMetadata() {
|
|||||||
CGM.getDiags().Report(DiagID);
|
CGM.getDiags().Report(DiagID);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// The vaiable has no definition - no need to add the entry.
|
||||||
|
if (CE->getVarSize().isZero())
|
||||||
|
continue;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OffloadEntriesInfoManagerTy::OMPTargetGlobalVarEntryLink:
|
case OffloadEntriesInfoManagerTy::OMPTargetGlobalVarEntryLink:
|
||||||
@ -8108,7 +8111,12 @@ void CGOpenMPRuntime::registerTargetGlobalVariable(const VarDecl *VD,
|
|||||||
case OMPDeclareTargetDeclAttr::MT_To:
|
case OMPDeclareTargetDeclAttr::MT_To:
|
||||||
Flags = OffloadEntriesInfoManagerTy::OMPTargetGlobalVarEntryTo;
|
Flags = OffloadEntriesInfoManagerTy::OMPTargetGlobalVarEntryTo;
|
||||||
VarName = CGM.getMangledName(VD);
|
VarName = CGM.getMangledName(VD);
|
||||||
|
if (VD->hasDefinition(CGM.getContext()) != VarDecl::DeclarationOnly) {
|
||||||
VarSize = CGM.getContext().getTypeSizeInChars(VD->getType());
|
VarSize = CGM.getContext().getTypeSizeInChars(VD->getType());
|
||||||
|
assert(!VarSize.isZero() && "Expected non-zero size of the variable");
|
||||||
|
} else {
|
||||||
|
VarSize = CharUnits::Zero();
|
||||||
|
}
|
||||||
Linkage = CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false);
|
Linkage = CGM.getLLVMLinkageVarDefinition(VD, /*IsConstant=*/false);
|
||||||
// Temp solution to prevent optimizations of the internal variables.
|
// Temp solution to prevent optimizations of the internal variables.
|
||||||
if (CGM.getLangOpts().OpenMPIsDevice && !VD->isExternallyVisible()) {
|
if (CGM.getLangOpts().OpenMPIsDevice && !VD->isExternallyVisible()) {
|
||||||
|
@ -143,4 +143,8 @@ int baz5() {
|
|||||||
// CHECK-DAG: declare extern_weak signext i32 @__create()
|
// CHECK-DAG: declare extern_weak signext i32 @__create()
|
||||||
|
|
||||||
// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}}
|
// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}}
|
||||||
|
|
||||||
|
// CHECK-DAG: !{i32 1, !"aaa", i32 0, i32 {{[0-9]+}}}
|
||||||
|
// CHECK-DAG: !{i32 1, !"ccc", i32 0, i32 {{[0-9]+}}}
|
||||||
|
|
||||||
#endif // HEADER
|
#endif // HEADER
|
||||||
|
Loading…
Reference in New Issue
Block a user