[OPENMP]Fix PR48658: [OpenMP 5.0] Compiler crash when OpenMP atomic sync hints used.

No need to consider hint clause kind as the main atomic clause kind at the
codegen.

Differential Revision: https://reviews.llvm.org/D99611
This commit is contained in:
Alexey Bataev 2021-03-30 10:36:23 -07:00
parent 98f08e7d81
commit 66da4f6fc9
2 changed files with 7 additions and 3 deletions

View File

@ -5594,7 +5594,11 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_exclusive:
case OMPC_uses_allocators:
case OMPC_affinity:
default:
case OMPC_init:
case OMPC_inbranch:
case OMPC_notinbranch:
case OMPC_link:
case OMPC_use:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}
@ -5626,7 +5630,7 @@ void CodeGenFunction::EmitOMPAtomicDirective(const OMPAtomicDirective &S) {
C->getClauseKind() != OMPC_acq_rel &&
C->getClauseKind() != OMPC_acquire &&
C->getClauseKind() != OMPC_release &&
C->getClauseKind() != OMPC_relaxed) {
C->getClauseKind() != OMPC_relaxed && C->getClauseKind() != OMPC_hint) {
Kind = C->getClauseKind();
break;
}

View File

@ -58,7 +58,7 @@ void parallel_atomic_ewc() {
// CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR]])
#pragma omp atomic
St().get() %= b;
#pragma omp atomic
#pragma omp atomic hint(6)
s.field++;
// CHECK: invoke void @_ZN2StC1Ev(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR:%.+]])
// CHECK: [[SCALAR_ADDR:%.+]] = invoke nonnull align 4 dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR]])