[flang][OpenMP] Semantic checks for metadirective loop nests (#207088) A loop-associated metadirective variant (`do`, `simd`, ...) is only resolved during lowering, so it is never checked as a loop construct during semantic analysis. A malformed or non-canonical associated nest therefore reaches lowering, which assumes a canonical nest. This patch validates the nest that follows such a variant (the next executable construct) during semantics, reusing the diagnostics of a real loop-associated construct. Each applicable variant is checked against it: * Canonical loop: the affected loop must be a canonical DO loop, so a `DO WHILE`, a pre-6.0 `DO CONCURRENT`, or a `DO` without loop control is rejected. * Nest depth: `collapse(n)` and `ordered(n)` must not exceed the depth of the associated loop nest. * Rectangularity: loops that must be rectangular (e.g. under `tile`) may not have bounds that depend on an outer loop's variable. A loop-associated variant may also have no loop nest at all. This happens when the metadirective ends the execution part or a non-loop construct follows it. Such a variant is rejected like a bare loop directive with no associated loop. Only variants that could be selected are checked: when a target is known, a WHEN variant whose device or implementation selector cannot match it is skipped (runtime `user` conditions never cause a skip). Part of the feature work for #188820. Builds on top of [#193664](https://github.com/llvm/llvm-project/issues/193664) and [#194424](https://github.com/llvm/llvm-project/pull/194424). Assisted with Copilot.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.