[all-commits] [llvm/llvm-project] b49f84: [Flang][OpenMP][Sema] Add directive rewrite pass t...

Sergio Afonso via All-commits all-commits at lists.llvm.org
Thu Oct 19 02:44:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b49f846fe529131d3762f7498eb5f89f61b5dd2c
      https://github.com/llvm/llvm-project/commit/b49f846fe529131d3762f7498eb5f89f61b5dd2c
  Author: Sergio Afonso <safonsof at amd.com>
  Date:   2023-10-19 (Thu, 19 Oct 2023)

  Changed paths:
    M flang/lib/Semantics/CMakeLists.txt
    M flang/lib/Semantics/check-omp-structure.cpp
    M flang/lib/Semantics/check-omp-structure.h
    A flang/lib/Semantics/rewrite-directives.cpp
    A flang/lib/Semantics/rewrite-directives.h
    M flang/lib/Semantics/rewrite-parse-tree.cpp
    A flang/test/Semantics/OpenMP/requires-atomic01.f90
    A flang/test/Semantics/OpenMP/requires-atomic02.f90

  Log Message:
  -----------
  [Flang][OpenMP][Sema] Add directive rewrite pass to support atomic_default_mem_order REQUIRES clause

This patch creates the `OmpRewriteMutator` pass that runs at the end of
`RewriteParseTree()`. This pass is intended to make OpenMP-specific mutations
to the PFT after name resolution.

In the case of the `atomic_default_mem_order` clause of the REQUIRES directive,
name resolution results in populating global symbols with information about the
REQUIRES clauses that apply to that scope. The new rewrite pass is then able to
use this information in order to explicitly set the memory order of ATOMIC
constructs for which that is not already specified.

Given that this rewrite happens before semantics checks, the check of the order
in which ATOMIC constructs without explicit memory order and REQUIRES
directives with `atomic_default_mem_order` appear is moved earlier into the
rewrite pass. Otherwise, these problems would not be caught by semantics
checks, since the PFT would be modified by that stage.

This is patch 4/5 of a series splitting D149337 to simplify review.

Depends on D157983.

Differential Revision: https://reviews.llvm.org/D158096




More information about the All-commits mailing list