forked from OSchip/llvm-project
[OPENMP]Fix emission of the target regions in virtual functions.
Fixed emission of the target regions found in the virtual functions. Previously we may end up with the situation when those regions could be skipped. llvm-svn: 347793
This commit is contained in:
parent
2c8a054310
commit
719713ab7d
|
@ -14968,8 +14968,11 @@ void Sema::MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
|
|||
// region.
|
||||
if (LangOpts.OpenMP && LangOpts.OpenMPIsDevice &&
|
||||
!isInOpenMPDeclareTargetContext() &&
|
||||
!isInOpenMPTargetExecutionDirective())
|
||||
!isInOpenMPTargetExecutionDirective()) {
|
||||
if (!DefinitionRequired)
|
||||
MarkVirtualMembersReferenced(Loc, Class);
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to insert this class into the map.
|
||||
LoadExternalVTableUses();
|
||||
|
|
|
@ -180,6 +180,30 @@ void B<T>::virtual_foo() {
|
|||
{}
|
||||
}
|
||||
|
||||
struct A {
|
||||
virtual void emitted() {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct C : public A {
|
||||
virtual void emitted();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void C<T>::emitted() {
|
||||
#pragma omp target
|
||||
{}
|
||||
}
|
||||
|
||||
int main() {
|
||||
A *X = new C<int>();
|
||||
X->emitted();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK-DAG: define {{.*}}void @__omp_offloading_{{.*}}virtual_foo{{.*}}_l[[@LINE-25]]()
|
||||
// CHECK-DAG: define {{.*}}void @__omp_offloading_{{.*}}emitted{{.*}}_l[[@LINE-11]]()
|
||||
|
||||
// CHECK-DAG: declare extern_weak signext i32 @__create()
|
||||
|
||||
// CHECK-NOT: define {{.*}}{{baz1|baz4|maini1|Base|virtual_}}
|
||||
|
|
Loading…
Reference in New Issue