================ @@ -2534,21 +2563,24 @@ static void emitCommonSimdLoop(CodeGenFunction &CGF, const OMPLoopDirective &S, static void emitOMPSimdRegion(CodeGenFunction &CGF, const OMPLoopDirective &S, PrePostActionTy &Action) { Action.Enter(CGF); - assert(isOpenMPSimdDirective(S.getDirectiveKind()) && - "Expected simd directive"); OMPLoopScope PreInitScope(CGF, S); // if (PreCond) { // for (IV in 0..LastIteration) BODY; // <Final counter/linear vars updates>; // } - // - if (isOpenMPDistributeDirective(S.getDirectiveKind()) || - isOpenMPWorksharingDirective(S.getDirectiveKind()) || - isOpenMPTaskLoopDirective(S.getDirectiveKind())) { - (void)EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getLowerBoundVariable())); - (void)EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getUpperBoundVariable())); + + // The presence of lower/upper bound variable depends on the actual directive + // kind in the AST node. The variables must be emitted because some of the + // expressions associated with the loop will use them. + OpenMPDirectiveKind DKind = S.getDirectiveKind(); + if (isOpenMPDistributeDirective(DKind) || + isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) || + isOpenMPGenericLoopDirective(DKind)) { + EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getLowerBoundVariable())); + EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getUpperBoundVariable())); ---------------- alexey-bataev wrote:
```suggestion (void)EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getLowerBoundVariable())); (void)EmitOMPHelperVar(CGF, cast<DeclRefExpr>(S.getUpperBoundVariable())); ``` https://github.com/llvm/llvm-project/pull/99905 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits