diff options
author | Ethan Luis McDonough <ethanluismcdonough@gmail.com> | 2023-05-05 14:50:14 -0500 |
---|---|---|
committer | Ethan Luis McDonough <ethanluismcdonough@gmail.com> | 2023-05-05 14:50:14 -0500 |
commit | 936d40cdb5c82ca74358b260dc69f7150209a81a (patch) | |
tree | f74c0970c0693511be7431143744105b9aba414b /flang/lib/Semantics | |
parent | afd3478f37c8734ec6a0f028f772645a108d14b2 (diff) | |
download | llvm-936d40cdb5c82ca74358b260dc69f7150209a81a.tar.gz |
Revert "[flang] OpenMP allocate directive parse tree fix"
This reverts commit 5faf45a3d24e603cbc8fe4eb45da386653dae5e5.
Once again arcanist stripped the co-author metadata. I'm going to add it to the revision description and try one last time.
Diffstat (limited to 'flang/lib/Semantics')
-rw-r--r-- | flang/lib/Semantics/canonicalize-omp.cpp | 45 | ||||
-rw-r--r-- | flang/lib/Semantics/resolve-directives.cpp | 3 |
2 files changed, 2 insertions, 46 deletions
diff --git a/flang/lib/Semantics/canonicalize-omp.cpp b/flang/lib/Semantics/canonicalize-omp.cpp index 013fb408214e..dc8a2a4d93af 100644 --- a/flang/lib/Semantics/canonicalize-omp.cpp +++ b/flang/lib/Semantics/canonicalize-omp.cpp @@ -15,9 +15,7 @@ // 1. move structured DoConstruct and OmpEndLoopDirective into // OpenMPLoopConstruct. Compilation will not proceed in case of errors // after this pass. -// 2. Associate declarative OMP allocation directives with their -// respective executable allocation directive -// 3. TBD +// 2. TBD namespace Fortran::semantics { using namespace parser::literals; @@ -48,8 +46,6 @@ public: } // Block list } - void Post(parser::ExecutionPart &body) { RewriteOmpAllocations(body); } - private: template <typename T> T *GetConstructIf(parser::ExecutionPartConstruct &x) { if (auto *y{std::get_if<parser::ExecutableConstruct>(&x.u)}) { @@ -60,15 +56,6 @@ private: return nullptr; } - template <typename T> T *GetOmpIf(parser::ExecutionPartConstruct &x) { - if (auto *construct{GetConstructIf<parser::OpenMPConstruct>(x)}) { - if (auto *omp{std::get_if<T>(&construct->u)}) { - return omp; - } - } - return nullptr; - } - void RewriteOpenMPLoopConstruct(parser::OpenMPLoopConstruct &x, parser::Block &block, parser::Block::iterator it) { // Check the sequence of DoConstruct and OmpEndLoopDirective @@ -119,36 +106,6 @@ private: parser::ToUpperCaseLetters(dir.source.ToString())); } - void RewriteOmpAllocations(parser::ExecutionPart &body) { - // Rewrite leading declarative allocations so they are nested - // within their respective executable allocate directive - // - // Original: - // ExecutionPartConstruct -> OpenMPDeclarativeAllocate - // ExecutionPartConstruct -> OpenMPDeclarativeAllocate - // ExecutionPartConstruct -> OpenMPExecutableAllocate - // - // After rewriting: - // ExecutionPartConstruct -> OpenMPExecutableAllocate - // ExecutionPartConstruct -> OpenMPDeclarativeAllocate - // ExecutionPartConstruct -> OpenMPDeclarativeAllocate - for (auto it = body.v.rbegin(); it != body.v.rend();) { - if (auto *exec = GetOmpIf<parser::OpenMPExecutableAllocate>(*(it++))) { - parser::OpenMPDeclarativeAllocate *decl; - std::list<parser::OpenMPDeclarativeAllocate> subAllocates; - while (it != body.v.rend() && - (decl = GetOmpIf<parser::OpenMPDeclarativeAllocate>(*it))) { - subAllocates.push_front(std::move(*decl)); - it = decltype(it)(body.v.erase(std::next(it).base())); - } - if (!subAllocates.empty()) { - std::get<std::optional<std::list<parser::OpenMPDeclarativeAllocate>>>( - exec->t) = {std::move(subAllocates)}; - } - } - } - } - parser::Messages &messages_; }; diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 1052c459632e..9eb4d9836491 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -1691,8 +1691,7 @@ void OmpAttributeVisitor::ResolveOmpObject( } } if (ompFlag == Symbol::Flag::OmpDeclarativeAllocateDirective && - IsAllocatable(*symbol) && - !IsNestedInDirective(llvm::omp::Directive::OMPD_allocate)) { + IsAllocatable(*symbol)) { context_.Say(designator.source, "List items specified in the ALLOCATE directive must not " "have the ALLOCATABLE attribute unless the directive is " |