functions.
If the combined construct is specified in the declare target function
and the device code is emitted, the compiler crashes because of the
incorrectly chosen captured stmt. We should choose the innermost
captured statement, not the outermost.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332477
91177308-0d34-0410-b5e6-
96231b3b80d8
OMPLexicalScope Scope(CGF, S, OMPD_target);
CGM.getOpenMPRuntime().emitInlinedDirective(
CGF, OMPD_target, [&S](CodeGenFunction &CGF, PrePostActionTy &) {
- CGF.EmitStmt(S.getCapturedStmt(OMPD_target)->getCapturedStmt());
+ CGF.EmitStmt(S.getInnermostCapturedStmt()->getCapturedStmt());
});
return;
}
int baz3() { return 2 + baz2(); }
int baz2() {
// CHECK-DAG: define weak void @__omp_offloading_{{.*}}baz2{{.*}}_l[[@LINE+1]](i64 {{.*}})
-#pragma omp target
+#pragma omp target parallel
++c;
return 2 + baz3();
}