[flang-commits] [flang] a141a9f - Revert "[OpenMP] atomic compare fail : Parser & AST support"

Mitch Phillips via flang-commits flang-commits at lists.llvm.org
Wed Nov 8 02:20:28 PST 2023


Author: Mitch Phillips
Date: 2023-11-08T11:20:17+01:00
New Revision: a141a9fa9706e939415a929a46b6f2f77cd56c55

URL: https://github.com/llvm/llvm-project/commit/a141a9fa9706e939415a929a46b6f2f77cd56c55
DIFF: https://github.com/llvm/llvm-project/commit/a141a9fa9706e939415a929a46b6f2f77cd56c55.diff

LOG: Revert "[OpenMP] atomic compare fail : Parser & AST support"

This reverts commit 086b65340cca2648a2a91a0a47d28c7d9bafd1e5.

Reason: Broke under -Werror. More details in
https://reviews.llvm.org/D123235

Added: 
    

Modified: 
    clang/include/clang/AST/OpenMPClause.h
    clang/include/clang/AST/RecursiveASTVisitor.h
    clang/include/clang/Basic/DiagnosticSemaKinds.td
    clang/include/clang/Basic/OpenMPKinds.def
    clang/include/clang/Sema/Sema.h
    clang/lib/AST/OpenMPClause.cpp
    clang/lib/AST/StmtProfile.cpp
    clang/lib/Basic/OpenMPKinds.cpp
    clang/lib/CodeGen/CGStmtOpenMP.cpp
    clang/lib/Parse/ParseOpenMP.cpp
    clang/lib/Sema/SemaOpenMP.cpp
    clang/lib/Sema/TreeTransform.h
    clang/lib/Serialization/ASTReader.cpp
    clang/lib/Serialization/ASTWriter.cpp
    clang/test/OpenMP/atomic_ast_print.cpp
    clang/test/OpenMP/atomic_messages.cpp
    clang/tools/libclang/CIndex.cpp
    flang/lib/Semantics/check-omp-structure.cpp
    llvm/include/llvm/Frontend/OpenMP/OMP.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index f7ecffe6154af80..549f12e87df597a 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -2513,104 +2513,6 @@ class OMPRelaxedClause final : public OMPClause {
   }
 };
 
-/// This represents 'fail' clause in the '#pragma omp atomic'
-/// directive.
-///
-/// \code
-/// #pragma omp atomic compare fail
-/// \endcode
-/// In this example directive '#pragma omp atomic compare' has 'fail' clause.
-class OMPFailClause final : public OMPClause {
-
-  // FailParameter is a memory-order-clause. Storing the ClauseKind is
-  // sufficient for our purpose.
-  OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
-  SourceLocation FailParameterLoc;
-  SourceLocation LParenLoc;
-
-  friend class OMPClauseReader;
-
-  /// Sets the location of '(' in fail clause.
-  void setLParenLoc(SourceLocation Loc) {
-    LParenLoc = Loc;
-  }
-
-  /// Sets the location of memoryOrder clause argument in fail clause.
-  void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
-
-  /// Sets the mem_order clause for 'atomic compare fail' directive.
-  void setFailParameter(OpenMPClauseKind FailParameter) {
-    switch (FailParameter) {
-    case llvm::omp::OMPC_acq_rel:
-    case llvm::omp::OMPC_acquire:
-      this->FailParameter = llvm::omp::OMPC_acquire;
-      break;
-    case llvm::omp::OMPC_relaxed:
-    case llvm::omp::OMPC_release:
-      this->FailParameter = llvm::omp::OMPC_relaxed;
-      break;
-    case llvm::omp::OMPC_seq_cst:
-      this->FailParameter = llvm::omp::OMPC_seq_cst;
-      break;
-    default:
-      this->FailParameter = llvm::omp::OMPC_unknown;
-      break;
-    }
-  }
-
-public:
-  /// Build 'fail' clause.
-  ///
-  /// \param StartLoc Starting location of the clause.
-  /// \param EndLoc Ending location of the clause.
-  OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
-      : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
-
-  OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation FailParameterLoc,
-                SourceLocation StartLoc, SourceLocation LParenLoc,
-                SourceLocation EndLoc)
-      : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
-        FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
-
-    setFailParameter(FailParameter);
-  }
-
-  /// Build an empty clause.
-  OMPFailClause()
-      : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
-
-  child_range children() {
-    return child_range(child_iterator(), child_iterator());
-  }
-
-  const_child_range children() const {
-    return const_child_range(const_child_iterator(), const_child_iterator());
-  }
-
-  child_range used_children() {
-    return child_range(child_iterator(), child_iterator());
-  }
-  const_child_range used_children() const {
-    return const_child_range(const_child_iterator(), const_child_iterator());
-  }
-
-  static bool classof(const OMPClause *T) {
-    return T->getClauseKind() == llvm::omp::OMPC_fail;
-  }
-
-  /// Gets the location of '(' (for the parameter) in fail clause.
-  SourceLocation getLParenLoc() const {
-    return LParenLoc;
-  }
-
-  /// Gets the location of Fail Parameter (type memory-order-clause) in
-  /// fail clause.
-  SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
-
-  /// Gets the parameter (type memory-order-clause) in Fail clause.
-  OpenMPClauseKind getFailParameter() const { return FailParameter; }
-};
-
 /// This represents clause 'private' in the '#pragma omp ...' directives.
 ///
 /// \code

diff  --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index c501801b95bd955..53bc15e1b19f668 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3398,11 +3398,6 @@ bool RecursiveASTVisitor<Derived>::VisitOMPCompareClause(OMPCompareClause *) {
   return true;
 }
 
-template <typename Derived>
-bool RecursiveASTVisitor<Derived>::VisitOMPFailClause(OMPFailClause *) {
-  return true;
-}
-
 template <typename Derived>
 bool RecursiveASTVisitor<Derived>::VisitOMPSeqCstClause(OMPSeqCstClause *) {
   return true;

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 18c2e861385e463..4614324babb1c91 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10962,8 +10962,6 @@ def note_omp_atomic_compare: Note<
   "expect binary operator in conditional expression|expect '<', '>' or '==' as order operator|expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'|"
   "expect lvalue for result value|expect scalar value|expect integer value|unexpected 'else' statement|expect '==' operator|expect an assignment statement 'v = x'|"
   "expect a 'if' statement|expect no more than two statements|expect a compound statement|expect 'else' statement|expect a form 'r = x == e; if (r) ...'}0">;
-def err_omp_atomic_fail_wrong_or_no_clauses : Error<"expected a memory order clause">;
-def err_omp_atomic_fail_no_compare : Error<"expected 'compare' clause with the 'fail' modifier">;
 def err_omp_atomic_several_clauses : Error<
   "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update', 'capture', or 'compare' clause">;
 def err_omp_several_mem_order_clauses : Error<

diff  --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def
index f98c4fd60eb4041..272537b769742b5 100644
--- a/clang/include/clang/Basic/OpenMPKinds.def
+++ b/clang/include/clang/Basic/OpenMPKinds.def
@@ -41,9 +41,6 @@
 #ifndef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
 #define OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(Name)
 #endif
-#ifndef OPENMP_ATOMIC_FAIL_MODIFIER
-#define OPENMP_ATOMIC_FAIL_MODIFIER(Name)
-#endif
 #ifndef OPENMP_AT_KIND
 #define OPENMP_AT_KIND(Name)
 #endif
@@ -141,13 +138,6 @@ OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(seq_cst)
 OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(acq_rel)
 OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND(relaxed)
 
-// Modifiers for atomic 'fail' clause.
-OPENMP_ATOMIC_FAIL_MODIFIER(seq_cst)
-OPENMP_ATOMIC_FAIL_MODIFIER(acquire)
-OPENMP_ATOMIC_FAIL_MODIFIER(acq_rel)
-OPENMP_ATOMIC_FAIL_MODIFIER(relaxed)
-OPENMP_ATOMIC_FAIL_MODIFIER(release)
-
 // Modifiers for 'at' clause.
 OPENMP_AT_KIND(compilation)
 OPENMP_AT_KIND(execution)
@@ -236,7 +226,6 @@ OPENMP_DOACROSS_MODIFIER(source_omp_cur_iteration)
 #undef OPENMP_SCHEDULE_MODIFIER
 #undef OPENMP_SCHEDULE_KIND
 #undef OPENMP_ATOMIC_DEFAULT_MEM_ORDER_KIND
-#undef OPENMP_ATOMIC_FAIL_MODIFIER
 #undef OPENMP_AT_KIND
 #undef OPENMP_SEVERITY_KIND
 #undef OPENMP_MAP_KIND

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index dd2b95fafe7593a..a8c41492b61ac4c 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -12186,13 +12186,6 @@ class Sema final {
   /// Called on well-formed 'compare' clause.
   OMPClause *ActOnOpenMPCompareClause(SourceLocation StartLoc,
                                       SourceLocation EndLoc);
-  /// Called on well-formed 'fail' clause.
-  OMPClause *ActOnOpenMPFailClause(SourceLocation StartLoc,
-                                   SourceLocation EndLoc);
-  OMPClause *ActOnOpenMPFailClause(
-      OpenMPClauseKind Kind, SourceLocation KindLoc,
-      SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
-
   /// Called on well-formed 'seq_cst' clause.
   OMPClause *ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);

diff  --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 04f680a8f5c92c8..4e19339a1361e6f 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -130,7 +130,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
   case OMPC_update:
   case OMPC_capture:
   case OMPC_compare:
-  case OMPC_fail:
   case OMPC_seq_cst:
   case OMPC_acq_rel:
   case OMPC_acquire:
@@ -228,7 +227,6 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
   case OMPC_update:
   case OMPC_capture:
   case OMPC_compare:
-  case OMPC_fail:
   case OMPC_seq_cst:
   case OMPC_acq_rel:
   case OMPC_acquire:
@@ -1927,16 +1925,6 @@ void OMPClausePrinter::VisitOMPCompareClause(OMPCompareClause *) {
   OS << "compare";
 }
 
-void OMPClausePrinter::VisitOMPFailClause(OMPFailClause *Node) {
-  OS << "fail";
-  if (Node) {
-    OS << "(";
-    OS << getOpenMPSimpleClauseTypeName(
-        Node->getClauseKind(), static_cast<int>(Node->getFailParameter()));
-    OS << ")";
-  }
-}
-
 void OMPClausePrinter::VisitOMPSeqCstClause(OMPSeqCstClause *) {
   OS << "seq_cst";
 }

diff  --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index d7b980a585702a5..8128219dd6f63c9 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -582,8 +582,6 @@ void OMPClauseProfiler::VisitOMPCaptureClause(const OMPCaptureClause *) {}
 
 void OMPClauseProfiler::VisitOMPCompareClause(const OMPCompareClause *) {}
 
-void OMPClauseProfiler::VisitOMPFailClause(const OMPFailClause *) {}
-
 void OMPClauseProfiler::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseProfiler::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}

diff  --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp
index 1165ee2ec4df19d..86de067da134a0a 100644
--- a/clang/lib/Basic/OpenMPKinds.cpp
+++ b/clang/lib/Basic/OpenMPKinds.cpp
@@ -104,11 +104,6 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind, StringRef Str,
   .Case(#Name, OMPC_ATOMIC_DEFAULT_MEM_ORDER_##Name)
 #include "clang/Basic/OpenMPKinds.def"
         .Default(OMPC_ATOMIC_DEFAULT_MEM_ORDER_unknown);
-  case OMPC_fail:
-    return static_cast<unsigned int>(llvm::StringSwitch<llvm::omp::Clause>(Str)
-#define OPENMP_ATOMIC_FAIL_MODIFIER(Name) .Case(#Name, OMPC_##Name)
-#include "clang/Basic/OpenMPKinds.def"
-                                         .Default(OMPC_unknown));
   case OMPC_device_type:
     return llvm::StringSwitch<OpenMPDeviceType>(Str)
 #define OPENMP_DEVICE_TYPE_KIND(Name) .Case(#Name, OMPC_DEVICE_TYPE_##Name)
@@ -439,18 +434,6 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
 #include "clang/Basic/OpenMPKinds.def"
     }
     llvm_unreachable("Invalid OpenMP 'depend' clause type");
-  case OMPC_fail: {
-    OpenMPClauseKind CK = static_cast<OpenMPClauseKind>(Type);
-    switch (CK) {
-    case OMPC_unknown:
-      return "unknown";
-#define OPENMP_ATOMIC_FAIL_MODIFIER(Name)                                      \
-  case OMPC_##Name:                                                            \
-    return #Name;
-#include "clang/Basic/OpenMPKinds.def"
-    }
-    llvm_unreachable("Invalid OpenMP 'fail' clause modifier");
-  }
   case OMPC_device:
     switch (Type) {
     case OMPC_DEVICE_unknown:

diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 478d6dbf9ca81d9..62b056c5d08a18c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -6516,10 +6516,6 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
                              IsPostfixUpdate, IsFailOnly, Loc);
     break;
   }
-  case OMPC_fail: {
-    //TODO
-    break;
-  }
   default:
     llvm_unreachable("Clause is not allowed in 'omp atomic'.");
   }

diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 57fdbde7bdbc48f..3e7d8274aeefc52 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -3248,7 +3248,6 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
     else
       Clause = ParseOpenMPSingleExprClause(CKind, WrongDirective);
     break;
-  case OMPC_fail:
   case OMPC_default:
   case OMPC_proc_bind:
   case OMPC_atomic_default_mem_order:

diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 85d09fc512fc0a1..e05fa54d8118319 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -12682,23 +12682,6 @@ StmtResult Sema::ActOnOpenMPAtomicDirective(ArrayRef<OMPClause *> Clauses,
       }
       break;
     }
-    case OMPC_fail: {
-      if (AtomicKind != OMPC_compare) {
-        Diag(C->getBeginLoc(), diag::err_omp_atomic_fail_no_compare)
-            << SourceRange(C->getBeginLoc(), C->getEndLoc());
-        return StmtError();
-      }
-      const auto *FC = cast<OMPFailClause>(C);
-      OpenMPClauseKind FailParameter = FC->getFailParameter();
-      SourceLocation DisplayLocation = FailParameter == OMPC_unknown
-                                           ? FC->getBeginLoc()
-                                           : FC->getFailParameterLoc();
-      if (FailParameter != OMPC_acq_rel && FailParameter != OMPC_acquire &&
-          FailParameter != OMPC_relaxed && FailParameter != OMPC_release &&
-          FailParameter != OMPC_seq_cst)
-        Diag(DisplayLocation, diag::err_omp_atomic_fail_wrong_or_no_clauses);
-      break;
-    }
     case OMPC_seq_cst:
     case OMPC_acq_rel:
     case OMPC_acquire:
@@ -16900,11 +16883,6 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
         static_cast<OpenMPAtomicDefaultMemOrderClauseKind>(Argument),
         ArgumentLoc, StartLoc, LParenLoc, EndLoc);
     break;
-  case OMPC_fail:
-    Res = ActOnOpenMPFailClause(
-        static_cast<OpenMPClauseKind>(Argument),
-        ArgumentLoc, StartLoc, LParenLoc, EndLoc);
-    break;
   case OMPC_update:
     Res = ActOnOpenMPUpdateClause(static_cast<OpenMPDependClauseKind>(Argument),
                                   ArgumentLoc, StartLoc, LParenLoc, EndLoc);
@@ -17545,9 +17523,6 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
   case OMPC_compare:
     Res = ActOnOpenMPCompareClause(StartLoc, EndLoc);
     break;
-  case OMPC_fail:
-    Res = ActOnOpenMPFailClause(StartLoc, EndLoc);
-    break;
   case OMPC_seq_cst:
     Res = ActOnOpenMPSeqCstClause(StartLoc, EndLoc);
     break;
@@ -17708,20 +17683,6 @@ OMPClause *Sema::ActOnOpenMPCompareClause(SourceLocation StartLoc,
   return new (Context) OMPCompareClause(StartLoc, EndLoc);
 }
 
-OMPClause *Sema::ActOnOpenMPFailClause(SourceLocation StartLoc,
-                                       SourceLocation EndLoc) {
-  return new (Context) OMPFailClause(StartLoc, EndLoc);
-}
-
-OMPClause *Sema::ActOnOpenMPFailClause(
-      OpenMPClauseKind Parameter, SourceLocation KindLoc,
-      SourceLocation StartLoc, SourceLocation LParenLoc,
-      SourceLocation EndLoc) {
-
-  return new (Context)
-      OMPFailClause(Parameter, KindLoc, StartLoc, LParenLoc, EndLoc);
-}
-
 OMPClause *Sema::ActOnOpenMPSeqCstClause(SourceLocation StartLoc,
                                          SourceLocation EndLoc) {
   return new (Context) OMPSeqCstClause(StartLoc, EndLoc);

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 8c574abd403f045..e24f710fdedd4e2 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -9866,12 +9866,6 @@ TreeTransform<Derived>::TransformOMPCompareClause(OMPCompareClause *C) {
   return C;
 }
 
-template <typename Derived>
-OMPClause *TreeTransform<Derived>::TransformOMPFailClause(OMPFailClause *C) {
-  // No need to rebuild this clause, no template-dependent parameters.
-  return C;
-}
-
 template <typename Derived>
 OMPClause *
 TreeTransform<Derived>::TransformOMPSeqCstClause(OMPSeqCstClause *C) {

diff  --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index e91d1c65e0f6a7e..42b48d230af7a97 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -10274,9 +10274,6 @@ OMPClause *OMPClauseReader::readClause() {
   case llvm::omp::OMPC_compare:
     C = new (Context) OMPCompareClause();
     break;
-  case llvm::omp::OMPC_fail:
-    C = new (Context) OMPFailClause();
-    break;
   case llvm::omp::OMPC_seq_cst:
     C = new (Context) OMPSeqCstClause();
     break;
@@ -10670,16 +10667,6 @@ void OMPClauseReader::VisitOMPCaptureClause(OMPCaptureClause *) {}
 
 void OMPClauseReader::VisitOMPCompareClause(OMPCompareClause *) {}
 
-// Read the parameter of fail clause. This will have been saved when
-// OMPClauseWriter is called.
-void OMPClauseReader::VisitOMPFailClause(OMPFailClause *C) {
-  C->setLParenLoc(Record.readSourceLocation());
-  SourceLocation FailParameterLoc = Record.readSourceLocation();
-  C->setFailParameterLoc(FailParameterLoc);
-  OpenMPClauseKind CKind = Record.readEnum<OpenMPClauseKind>();
-  C->setFailParameter(CKind);
-}
-
 void OMPClauseReader::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseReader::VisitOMPAcqRelClause(OMPAcqRelClause *) {}

diff  --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 0d347d86cb2eb44..1e86566d81fbc02 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -6620,13 +6620,6 @@ void OMPClauseWriter::VisitOMPCaptureClause(OMPCaptureClause *) {}
 
 void OMPClauseWriter::VisitOMPCompareClause(OMPCompareClause *) {}
 
-// Save the parameter of fail clause.
-void OMPClauseWriter::VisitOMPFailClause(OMPFailClause *C) {
-  Record.AddSourceLocation(C->getLParenLoc());
-  Record.AddSourceLocation(C->getFailParameterLoc());
-  Record.writeEnum(C->getFailParameter());
-}
-
 void OMPClauseWriter::VisitOMPSeqCstClause(OMPSeqCstClause *) {}
 
 void OMPClauseWriter::VisitOMPAcqRelClause(OMPAcqRelClause *) {}

diff  --git a/clang/test/OpenMP/atomic_ast_print.cpp b/clang/test/OpenMP/atomic_ast_print.cpp
index 21d70e6b01ff691..d82beb1da485081 100644
--- a/clang/test/OpenMP/atomic_ast_print.cpp
+++ b/clang/test/OpenMP/atomic_ast_print.cpp
@@ -226,16 +226,6 @@ T foo(T argc) {
   { v = a; if (a < b) { a = b; } }
 #pragma omp atomic compare capture hint(6)
   { v = a == b; if (v) a = c; }
-#pragma omp atomic compare fail(acq_rel)
-  { if (a < c) { a = c; } }
-#pragma omp atomic compare fail(acquire)
-  { if (a < c) { a = c; } }
-#pragma omp atomic compare fail(release)
-  { if (a < c) { a = c; } }
-#pragma omp atomic compare fail(relaxed)
-  { if (a < c) { a = c; } }
-#pragma omp atomic compare fail(seq_cst)
-  { if (a < c) { a = c; } }
 #endif
   return T();
 }
@@ -1109,16 +1099,6 @@ int main(int argc, char **argv) {
   { v = a; if (a < b) { a = b; } }
 #pragma omp atomic compare capture hint(6)
   { v = a == b; if (v) a = c; }
-#pragma omp atomic compare fail(acq_rel)
-  if(a < b) { a = b; }
-#pragma omp atomic compare fail(acquire)
-  if(a < b) { a = b; }
-#pragma omp atomic compare fail(release)
-  if(a < b) { a = b; }
-#pragma omp atomic compare fail(relaxed)
-  if(a < b) { a = b; }
-#pragma omp atomic compare fail(seq_cst)
-  if(a < b) { a = b; }
 #endif
   // CHECK-NEXT: #pragma omp atomic
   // CHECK-NEXT: a++;
@@ -1449,26 +1429,6 @@ int main(int argc, char **argv) {
   // CHECK-51-NEXT: if (v)
   // CHECK-51-NEXT: a = c;
   // CHECK-51-NEXT: }
-  // CHECK-51-NEXT: #pragma omp atomic compare fail(acquire)
-  // CHECK-51-NEXT: if (a < b) {
-  // CHECK-51-NEXT: a = b;
-  // CHECK-51-NEXT: }
-  // CHECK-51-NEXT: #pragma omp atomic compare fail(acquire)
-  // CHECK-51-NEXT: if (a < b) {
-  // CHECK-51-NEXT: a = b;
-  // CHECK-51-NEXT: }
-  // CHECK-51-NEXT: #pragma omp atomic compare fail(relaxed)
-  // CHECK-51-NEXT: if (a < b) {
-  // CHECK-51-NEXT: a = b;
-  // CHECK-51-NEXT: }
-  // CHECK-51-NEXT: #pragma omp atomic compare fail(relaxed)
-  // CHECK-51-NEXT: if (a < b) {
-  // CHECK-51-NEXT: a = b;
-  // CHECK-51-NEXT: }
-  // CHECK-51-NEXT: #pragma omp atomic compare fail(seq_cst)
-  // CHECK-51-NEXT: if (a < b) {
-  // CHECK-51-NEXT: a = b;
-  // CHECK-51-NEXT: }
   // expect-note at +1 {{in instantiation of function template specialization 'foo<int>' requested here}}
   return foo(a);
 }

diff  --git a/clang/test/OpenMP/atomic_messages.cpp b/clang/test/OpenMP/atomic_messages.cpp
index b09e3318cd9ac04..d54c17a9dd37f55 100644
--- a/clang/test/OpenMP/atomic_messages.cpp
+++ b/clang/test/OpenMP/atomic_messages.cpp
@@ -958,24 +958,6 @@ int mixed() {
 // expected-error at +1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
 #pragma omp atomic compare compare capture capture
   { v = a; if (a > b) a = b; }
-// expected-error at +1 {{expected 'compare' clause with the 'fail' modifier}}
-#pragma omp atomic fail(seq_cst)
-  if(v == a) { v = a; }
-// expected-error at +1 {{expected '(' after 'fail'}}
-#pragma omp atomic compare fail
-  if(v < a) { v = a; }
-// expected-error at +1 {{expected a memory order clause}}
-#pragma omp atomic compare fail(capture)
-  if(v < a) { v = a; }
- // expected-error at +2 {{expected ')'}}
- // expected-note at +1 {{to match this '('}}
-#pragma omp atomic compare fail(seq_cst | acquire)
-  if(v < a) { v = a; }
-// expected-error at +1 {{directive '#pragma omp atomic' cannot contain more than one 'fail' clause}}
-#pragma omp atomic compare fail(relaxed) fail(seq_cst)
-  if(v < a) { v = a; }
-
-
 #endif
   // expected-note at +1 {{in instantiation of function template specialization 'mixed<int>' requested here}}
   return mixed<int>();

diff  --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index a449fa4d4af43a2..df630f66f0b946a 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2402,8 +2402,6 @@ void OMPClauseEnqueue::VisitOMPCaptureClause(const OMPCaptureClause *) {}
 
 void OMPClauseEnqueue::VisitOMPCompareClause(const OMPCompareClause *) {}
 
-void OMPClauseEnqueue::VisitOMPFailClause(const OMPFailClause *) {}
-
 void OMPClauseEnqueue::VisitOMPSeqCstClause(const OMPSeqCstClause *) {}
 
 void OMPClauseEnqueue::VisitOMPAcqRelClause(const OMPAcqRelClause *) {}

diff  --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 1d3006dde7e848d..d7a0681d1c3d476 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -2227,7 +2227,6 @@ CHECK_SIMPLE_CLAUSE(CancellationConstructType, OMPC_cancellation_construct_type)
 CHECK_SIMPLE_CLAUSE(Doacross, OMPC_doacross)
 CHECK_SIMPLE_CLAUSE(OmpxAttribute, OMPC_ompx_attribute)
 CHECK_SIMPLE_CLAUSE(OmpxBare, OMPC_ompx_bare)
-CHECK_SIMPLE_CLAUSE(Fail, OMPC_fail)
 
 CHECK_REQ_SCALAR_INT_CLAUSE(Grainsize, OMPC_grainsize)
 CHECK_REQ_SCALAR_INT_CLAUSE(NumTasks, OMPC_num_tasks)

diff  --git a/llvm/include/llvm/Frontend/OpenMP/OMP.td b/llvm/include/llvm/Frontend/OpenMP/OMP.td
index 5ac0f83b2b6f66a..f8b3b0c7524979b 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMP.td
+++ b/llvm/include/llvm/Frontend/OpenMP/OMP.td
@@ -209,7 +209,6 @@ def OMPC_Write : Clause<"write"> { let clangClass = "OMPWriteClause"; }
 def OMPC_Update : Clause<"update"> { let clangClass = "OMPUpdateClause"; }
 def OMPC_Capture : Clause<"capture"> { let clangClass = "OMPCaptureClause"; }
 def OMPC_Compare : Clause<"compare"> { let clangClass = "OMPCompareClause"; }
-def OMPC_Fail : Clause<"fail"> { let clangClass = "OMPFailClause"; }
 def OMPC_SeqCst : Clause<"seq_cst"> { let clangClass = "OMPSeqCstClause"; }
 def OMPC_AcqRel : Clause<"acq_rel"> { let clangClass = "OMPAcqRelClause"; }
 def OMPC_Acquire : Clause<"acquire"> { let clangClass = "OMPAcquireClause"; }
@@ -638,8 +637,7 @@ def OMP_Atomic : Directive<"atomic"> {
     VersionedClause<OMPC_Acquire, 50>,
     VersionedClause<OMPC_Release, 50>,
     VersionedClause<OMPC_Relaxed, 50>,
-    VersionedClause<OMPC_Hint, 50>,
-    VersionedClause<OMPC_Fail, 51>
+    VersionedClause<OMPC_Hint, 50>
   ];
 }
 def OMP_Target : Directive<"target"> {


        


More information about the flang-commits mailing list