@@ -6031,22 +6031,6 @@ static StmtResult cloneAssociatedStmt(const ASTContext &Context, Stmt *StmtP,
60316031/// Call traits associated with a function call are removed and replaced with
60326032/// a direct call. For clause "nocontext" only, the direct call is then
60336033/// modified to have call traits for a non-dispatch variant.
6034- /// For "nocontext" an example is provided below for clear understanding.
6035- ///
6036- /// #pragma omp declare variant(foo_variant_dispatch)
6037- /// match(construct={dispatch}) #pragma omp declare variant(foo_variant_allCond)
6038- /// match(user={condition(1)})
6039- /// ...
6040- /// #pragma omp dispatch nocontext(cond_true)
6041- /// foo(i, j); // with traits: CodeGen call to foo_variant_dispatch(i,j)
6042- /// dispatch construct is changed to:
6043- /// if (cond_true) {
6044- /// foo(i,j) // with traits: CodeGen call to foo_variant_allCond(i,j)
6045- /// } else {
6046- /// #pragma omp dispatch
6047- /// foo(i,j) // with traits: CodeGen call to foo_variant_dispatch(i,j)
6048- /// }
6049- ///
60506034static Expr *replaceWithNewTraitsOrDirectCall(const ASTContext &Context,
60516035 Expr *AssocExpr,
60526036 SemaOpenMP *SemaPtr,
@@ -6071,6 +6055,24 @@ static Expr *replaceWithNewTraitsOrDirectCall(const ASTContext &Context,
60716055
60726056 Expr *FinalCall = CallWithoutInvariants; // For noinvariants clause
60736057 if (NoContext) {
6058+ // example to explain the changes done for "nocontext" clause:
6059+ //
6060+ // #pragma omp declare variant(foo_variant_dispatch)
6061+ // match(construct = {dispatch})
6062+ // #pragma omp declare variant(foo_variant_allCond)
6063+ // match(user = {condition(1)})
6064+ // ...
6065+ // #pragma omp dispatch nocontext(cond_true)
6066+ // foo(i, j); // with traits: CodeGen call to
6067+ // foo_variant_dispatch(i,j)
6068+ // dispatch construct is changed to:
6069+ // if (cond_true) {
6070+ // foo(i,j) // with traits: CodeGen call to foo_variant_allCond(i,j)
6071+ // } else {
6072+ // #pragma omp dispatch
6073+ // foo(i,j) // with traits: CodeGen call to foo_variant_dispatch(i,j)
6074+ // }
6075+
60746076 // Convert StmtResult to a CallExpr before calling ActOnOpenMPCall()
60756077 auto *CallExprWithinStmt = cast<CallExpr>(CallWithoutInvariants);
60766078 int NumArgs = CallExprWithinStmt->getNumArgs();
0 commit comments