llvm-project/clang/test/utils/update_cc_test_checks
Johannes Doerfert df729e2b82 [OpenMP] Overhaul `declare target` handling
This patch fixes various issues with our prior `declare target` handling
and extends it to support `omp begin declare target` as well.

This started with PR49649 in mind, trying to provide a way for users to
avoid the "ref" global use introduced for globals with internal linkage.
From there it went down the rabbit hole, e.g., all variables, even
`nohost` ones, were emitted into the device code so it was impossible to
determine if "ref" was needed late in the game (based on the name only).
To make it really useful, `begin declare target` was needed as it can
carry the `device_type`. Not emitting variables eagerly had a ripple
effect. Finally, the precedence of the (explicit) declare target list
items needed to be taken into account, that meant we cannot just look
for any declare target attribute to make a decision. This caused the
handling of functions to require fixup as well.

I tried to clean up things while I was at it, e.g., we should not "parse
declarations and defintions" as part of OpenMP parsing, this will always
break at some point. Instead, we keep track what region we are in and
act on definitions and declarations instead, this is what we do for
declare variant and other begin/end directives already.

Highlights:
  - new diagnosis for restrictions specificed in the standard,
  - delayed emission of globals not mentioned in an explicit
    list of a declare target,
  - omission of `nohost` globals on the host and `host` globals on the
    device,
  - no explicit parsing of declarations in-between `omp [begin] declare
    variant` and the corresponding end anymore, regular parsing instead,
  - precedence for explicit mentions in `declare target` lists over
    implicit mentions in the declaration-definition-seq, and
  - `omp allocate` declarations will now replace an earlier emitted
    global, if necessary.

---

Notes:

The patch is larger than I hoped but it turns out that most changes do
on their own lead to "inconsistent states", which seem less desirable
overall.

After working through this I feel the standard should remove the
explicit declare target forms as the delayed emission is horrible.
That said, while we delay things anyway, it seems to me we check too
often for the current status even though that is often not sufficient to
act upon. There seems to be a lot of duplication that can probably be
trimmed down. Eagerly emitting some things seems pretty weak as an
argument to keep so much logic around.

---

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D101030
2021-05-06 02:10:41 -05:00
..
Inputs [OpenMP] Overhaul `declare target` handling 2021-05-06 02:10:41 -05:00
basic-cplusplus.test [update_cc_test_checks.py] Add test for D84511 2020-08-06 09:15:56 +01:00
check_attrs.test [Utils] Check function attributes in update_test_checks 2020-07-19 20:07:24 +02:00
def-and-decl.test
exec-all-runlines.test Run non-filechecked commands in update_cc_test_checks.py 2021-03-10 12:25:35 -08:00
generated-funcs-regex.test [Utils][NFC] Rename replace-function-regex in update_cc_test_checks 2021-05-05 14:19:30 -07:00
generated-funcs.test [UpdateCCTestChecks] Include generated functions if asked 2020-09-18 06:34:59 -05:00
lit.local.cfg [update_cc_test_checks.py] Add test for D84511 2020-08-06 09:15:56 +01:00
mangled_names.test [UpdateTestChecks] Add UTC_ARGS support for update_{llc,cc}_test_checks.py 2020-07-08 11:00:10 +01:00
on_the_fly_arg_change.test [UpdateTestChecks] Add UTC_ARGS support for update_{llc,cc}_test_checks.py 2020-07-08 11:00:10 +01:00
prefix-never-matches.test [utils] Fix UpdateTestChecks case where 2 runs differ for last label 2020-12-15 07:16:54 -08:00
resolve-tmp-conflict.test [Utils] Add prefix parameter in update test checks to avoid FileCheck conflicts 2021-03-26 11:49:42 -07:00