Skip to content

[NFC][OpenACC] Refactor clause emission- #140586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025

Conversation

erichkeane
Copy link
Collaborator

Having the whole clause emission be in a header file ended up being pragmatic, but ended up being a sizable negative for a variety of reasons. This patch moves it to its own .cpp file and makes CIRGenFunction instead call into the visitor via a template instead.

This is possible because the valid list of construct kinds is quite finite, and easy to enumerate.

Having the whole clause emission be in a header file ended up being
pragmatic, but ended up being a sizable negative for a variety of
reasons.  This patch moves it to its own .cpp file and makes
CIRGenFunction instead call into the visitor via a template instead.

This is possible because the valid list of construct kinds is quite
finite, and easy to enumerate.
@erichkeane erichkeane requested a review from andykaylor May 19, 2025 17:57
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels May 19, 2025
@llvmbot
Copy link
Member

llvmbot commented May 19, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clangir

Author: Erich Keane (erichkeane)

Changes

Having the whole clause emission be in a header file ended up being pragmatic, but ended up being a sizable negative for a variety of reasons. This patch moves it to its own .cpp file and makes CIRGenFunction instead call into the visitor via a template instead.

This is possible because the valid list of construct kinds is quite finite, and easy to enumerate.


Patch is 20.73 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/140586.diff

5 Files Affected:

  • (modified) clang/lib/CIR/CodeGen/CIRGenFunction.h (+15)
  • (renamed) clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp (+132-89)
  • (modified) clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp (+4-25)
  • (modified) clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp (+2-11)
  • (modified) clang/lib/CIR/CodeGen/CMakeLists.txt (+1)
diff --git a/clang/lib/CIR/CodeGen/CIRGenFunction.h b/clang/lib/CIR/CodeGen/CIRGenFunction.h
index f7670eda7ef87..8967dcb3af273 100644
--- a/clang/lib/CIR/CodeGen/CIRGenFunction.h
+++ b/clang/lib/CIR/CodeGen/CIRGenFunction.h
@@ -724,6 +724,21 @@ class CIRGenFunction : public CIRGenTypeCache {
       SourceLocation dirLoc, llvm::ArrayRef<const OpenACCClause *> clauses,
       const Stmt *loopStmt);
 
+  template <typename Op>
+  void emitOpenACCClauses(Op &op, OpenACCDirectiveKind dirKind,
+                          SourceLocation dirLoc,
+                          ArrayRef<const OpenACCClause *> clauses);
+  // The second template argument doesn't need to be a template, since it should
+  // always be an mlir::acc::LoopOp, but as this is a template anyway, we make
+  // it a template argument as this way we can avoid including the OpenACC MLIR
+  // headers here. We will count on linker failures/explicit instantiation to
+  // ensure we don't mess this up, but it is only called from 1 place, and
+  // instantiated 3x.
+  template <typename ComputeOp, typename LoopOp>
+  void emitOpenACCClauses(ComputeOp &op, LoopOp &loopOp,
+                          OpenACCDirectiveKind dirKind, SourceLocation dirLoc,
+                          ArrayRef<const OpenACCClause *> clauses);
+
 public:
   mlir::LogicalResult
   emitOpenACCComputeConstruct(const OpenACCComputeConstruct &s);
diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenACCClause.h b/clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp
similarity index 82%
rename from clang/lib/CIR/CodeGen/CIRGenOpenACCClause.h
rename to clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp
index ecbc8ce6b525a..291aa0db4c498 100644
--- a/clang/lib/CIR/CodeGen/CIRGenOpenACCClause.h
+++ b/clang/lib/CIR/CodeGen/CIRGenOpenACCClause.cpp
@@ -12,10 +12,16 @@
 
 #include <type_traits>
 
+#include "CIRGenFunction.h"
+
 #include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "llvm/ADT/TypeSwitch.h"
-namespace clang {
+
+using namespace clang;
+using namespace clang::CIRGen;
+
+namespace {
 // Simple type-trait to see if the first template arg is one of the list, so we
 // can tell whether to `if-constexpr` a bunch of stuff.
 template <typename ToTest, typename T, typename... Tys>
@@ -32,77 +38,10 @@ template <typename CompOpTy> struct CombinedConstructClauseInfo {
   ComputeOpTy computeOp;
   mlir::acc::LoopOp loopOp;
 };
-
 template <typename ToTest> constexpr bool isCombinedType = false;
 template <typename T>
 constexpr bool isCombinedType<CombinedConstructClauseInfo<T>> = true;
 
-namespace {
-struct DataOperandInfo {
-  mlir::Location beginLoc;
-  mlir::Value varValue;
-  llvm::StringRef name;
-};
-
-inline mlir::Value emitOpenACCIntExpr(CIRGen::CIRGenFunction &cgf,
-                                      CIRGen::CIRGenBuilderTy &builder,
-                                      const Expr *intExpr) {
-  mlir::Value expr = cgf.emitScalarExpr(intExpr);
-  mlir::Location exprLoc = cgf.cgm.getLoc(intExpr->getBeginLoc());
-
-  mlir::IntegerType targetType = mlir::IntegerType::get(
-      &cgf.getMLIRContext(), cgf.getContext().getIntWidth(intExpr->getType()),
-      intExpr->getType()->isSignedIntegerOrEnumerationType()
-          ? mlir::IntegerType::SignednessSemantics::Signed
-          : mlir::IntegerType::SignednessSemantics::Unsigned);
-
-  auto conversionOp = builder.create<mlir::UnrealizedConversionCastOp>(
-      exprLoc, targetType, expr);
-  return conversionOp.getResult(0);
-}
-
-// A helper function that gets the information from an operand to a data
-// clause, so that it can be used to emit the data operations.
-inline DataOperandInfo getDataOperandInfo(CIRGen::CIRGenFunction &cgf,
-                                          CIRGen::CIRGenBuilderTy &builder,
-                                          OpenACCDirectiveKind dk,
-                                          const Expr *e) {
-  // TODO: OpenACC: Cache was different enough as to need a separate
-  // `ActOnCacheVar`, so we are going to need to do some investigations here
-  // when it comes to implement this for cache.
-  if (dk == OpenACCDirectiveKind::Cache) {
-    cgf.cgm.errorNYI(e->getSourceRange(),
-                     "OpenACC data operand for 'cache' directive");
-    return {cgf.cgm.getLoc(e->getBeginLoc()), {}, {}};
-  }
-
-  const Expr *curVarExpr = e->IgnoreParenImpCasts();
-
-  mlir::Location exprLoc = cgf.cgm.getLoc(curVarExpr->getBeginLoc());
-
-  // TODO: OpenACC: Assemble the list of bounds.
-  if (isa<ArraySectionExpr, ArraySubscriptExpr>(curVarExpr)) {
-    cgf.cgm.errorNYI(curVarExpr->getSourceRange(),
-                     "OpenACC data clause array subscript/section");
-    return {exprLoc, {}, {}};
-  }
-
-  // TODO: OpenACC: if this is a member expr, emit the VarPtrPtr correctly.
-  if (isa<MemberExpr>(curVarExpr)) {
-    cgf.cgm.errorNYI(curVarExpr->getSourceRange(),
-                     "OpenACC Data clause member expr");
-    return {exprLoc, {}, {}};
-  }
-
-  // Sema has made sure that only 4 types of things can get here, array
-  // subscript, array section, member expr, or DRE to a var decl (or the former
-  // 3 wrapping a var-decl), so we should be able to assume this is right.
-  const auto *dre = cast<DeclRefExpr>(curVarExpr);
-  const auto *vd = cast<VarDecl>(dre->getFoundDecl()->getCanonicalDecl());
-  return {exprLoc, cgf.emitDeclRefLValue(dre).getPointer(), vd->getName()};
-}
-} //  namespace
-
 template <typename OpTy>
 class OpenACCClauseCIREmitter final
     : public OpenACCClauseVisitor<OpenACCClauseCIREmitter<OpTy>> {
@@ -127,6 +66,10 @@ class OpenACCClauseCIREmitter final
   // Keep track of the data operands so that we can update their async clauses.
   llvm::SmallVector<mlir::Operation *> dataOperands;
 
+  void clauseNotImplemented(const OpenACCClause &c) {
+    cgf.cgm.errorNYI(c.getSourceRange(), "OpenACC Clause", c.getClauseKind());
+  }
+
   void setLastDeviceTypeClause(const OpenACCDeviceTypeClause &clause) {
     lastDeviceTypeValues.clear();
 
@@ -137,12 +80,19 @@ class OpenACCClauseCIREmitter final
                    });
   }
 
-  void clauseNotImplemented(const OpenACCClause &c) {
-    cgf.cgm.errorNYI(c.getSourceRange(), "OpenACC Clause", c.getClauseKind());
-  }
+  mlir::Value emitIntExpr(const Expr *intExpr) {
+    mlir::Value expr = cgf.emitScalarExpr(intExpr);
+    mlir::Location exprLoc = cgf.cgm.getLoc(intExpr->getBeginLoc());
 
-  mlir::Value emitOpenACCIntExpr(const Expr *intExpr) {
-    return clang::emitOpenACCIntExpr(cgf, builder, intExpr);
+    mlir::IntegerType targetType = mlir::IntegerType::get(
+        &cgf.getMLIRContext(), cgf.getContext().getIntWidth(intExpr->getType()),
+        intExpr->getType()->isSignedIntegerOrEnumerationType()
+            ? mlir::IntegerType::SignednessSemantics::Signed
+            : mlir::IntegerType::SignednessSemantics::Unsigned);
+
+    auto conversionOp = builder.create<mlir::UnrealizedConversionCastOp>(
+        exprLoc, targetType, expr);
+    return conversionOp.getResult(0);
   }
 
   // 'condition' as an OpenACC grammar production is used for 'if' and (some
@@ -218,11 +168,56 @@ class OpenACCClauseCIREmitter final
     computeEmitter.Visit(&c);
   }
 
+  struct DataOperandInfo {
+    mlir::Location beginLoc;
+    mlir::Value varValue;
+    llvm::StringRef name;
+  };
+
+  // A helper function that gets the information from an operand to a data
+  // clause, so that it can be used to emit the data operations.
+  inline DataOperandInfo getDataOperandInfo(OpenACCDirectiveKind dk,
+                                            const Expr *e) {
+    // TODO: OpenACC: Cache was different enough as to need a separate
+    // `ActOnCacheVar`, so we are going to need to do some investigations here
+    // when it comes to implement this for cache.
+    if (dk == OpenACCDirectiveKind::Cache) {
+      cgf.cgm.errorNYI(e->getSourceRange(),
+                       "OpenACC data operand for 'cache' directive");
+      return {cgf.cgm.getLoc(e->getBeginLoc()), {}, {}};
+    }
+
+    const Expr *curVarExpr = e->IgnoreParenImpCasts();
+
+    mlir::Location exprLoc = cgf.cgm.getLoc(curVarExpr->getBeginLoc());
+
+    // TODO: OpenACC: Assemble the list of bounds.
+    if (isa<ArraySectionExpr, ArraySubscriptExpr>(curVarExpr)) {
+      cgf.cgm.errorNYI(curVarExpr->getSourceRange(),
+                       "OpenACC data clause array subscript/section");
+      return {exprLoc, {}, {}};
+    }
+
+    // TODO: OpenACC: if this is a member expr, emit the VarPtrPtr correctly.
+    if (isa<MemberExpr>(curVarExpr)) {
+      cgf.cgm.errorNYI(curVarExpr->getSourceRange(),
+                       "OpenACC Data clause member expr");
+      return {exprLoc, {}, {}};
+    }
+
+    // Sema has made sure that only 4 types of things can get here, array
+    // subscript, array section, member expr, or DRE to a var decl (or the
+    // former 3 wrapping a var-decl), so we should be able to assume this is
+    // right.
+    const auto *dre = cast<DeclRefExpr>(curVarExpr);
+    const auto *vd = cast<VarDecl>(dre->getFoundDecl()->getCanonicalDecl());
+    return {exprLoc, cgf.emitDeclRefLValue(dre).getPointer(), vd->getName()};
+  }
+
   template <typename BeforeOpTy, typename AfterOpTy>
   void addDataOperand(const Expr *varOperand, mlir::acc::DataClause dataClause,
                       bool structured, bool implicit) {
-    DataOperandInfo opInfo =
-        getDataOperandInfo(cgf, builder, dirKind, varOperand);
+    DataOperandInfo opInfo = getDataOperandInfo(dirKind, varOperand);
     mlir::ValueRange bounds;
 
     // TODO: OpenACC: we should comprehend the 'modifier-list' here for the data
@@ -394,7 +389,7 @@ class OpenACCClauseCIREmitter final
     if constexpr (isOneOfTypes<OpTy, mlir::acc::ParallelOp,
                                mlir::acc::KernelsOp>) {
       operation.addNumWorkersOperand(builder.getContext(),
-                                     emitOpenACCIntExpr(clause.getIntExpr()),
+                                     emitIntExpr(clause.getIntExpr()),
                                      lastDeviceTypeValues);
     } else if constexpr (isCombinedType<OpTy>) {
       applyToComputeOp(clause);
@@ -407,7 +402,7 @@ class OpenACCClauseCIREmitter final
     if constexpr (isOneOfTypes<OpTy, mlir::acc::ParallelOp,
                                mlir::acc::KernelsOp>) {
       operation.addVectorLengthOperand(builder.getContext(),
-                                       emitOpenACCIntExpr(clause.getIntExpr()),
+                                       emitIntExpr(clause.getIntExpr()),
                                        lastDeviceTypeValues);
     } else if constexpr (isCombinedType<OpTy>) {
       applyToComputeOp(clause);
@@ -432,7 +427,7 @@ class OpenACCClauseCIREmitter final
           mlir::OpBuilder::InsertionGuard guardCase(builder);
           if (!dataOperands.empty())
             builder.setInsertionPoint(dataOperands.front());
-          intExpr = emitOpenACCIntExpr(clause.getIntExpr());
+          intExpr = emitIntExpr(clause.getIntExpr());
         }
         operation.addAsyncOperand(builder.getContext(), intExpr,
                                   lastDeviceTypeValues);
@@ -444,7 +439,7 @@ class OpenACCClauseCIREmitter final
         operation.setAsync(true);
       else
         operation.getAsyncOperandMutable().append(
-            emitOpenACCIntExpr(clause.getIntExpr()));
+            emitIntExpr(clause.getIntExpr()));
     } else if constexpr (isCombinedType<OpTy>) {
       applyToComputeOp(clause);
     } else {
@@ -499,8 +494,7 @@ class OpenACCClauseCIREmitter final
   void VisitDeviceNumClause(const OpenACCDeviceNumClause &clause) {
     if constexpr (isOneOfTypes<OpTy, mlir::acc::InitOp, mlir::acc::ShutdownOp,
                                mlir::acc::SetOp>) {
-      operation.getDeviceNumMutable().append(
-          emitOpenACCIntExpr(clause.getIntExpr()));
+      operation.getDeviceNumMutable().append(emitIntExpr(clause.getIntExpr()));
     } else {
       llvm_unreachable(
           "init, shutdown, set, are only valid device_num constructs");
@@ -512,7 +506,7 @@ class OpenACCClauseCIREmitter final
                                mlir::acc::KernelsOp>) {
       llvm::SmallVector<mlir::Value> values;
       for (const Expr *E : clause.getIntExprs())
-        values.push_back(emitOpenACCIntExpr(E));
+        values.push_back(emitIntExpr(E));
 
       operation.addNumGangsOperands(builder.getContext(), values,
                                     lastDeviceTypeValues);
@@ -531,9 +525,9 @@ class OpenACCClauseCIREmitter final
       } else {
         llvm::SmallVector<mlir::Value> values;
         if (clause.hasDevNumExpr())
-          values.push_back(emitOpenACCIntExpr(clause.getDevNumExpr()));
+          values.push_back(emitIntExpr(clause.getDevNumExpr()));
         for (const Expr *E : clause.getQueueIdExprs())
-          values.push_back(emitOpenACCIntExpr(E));
+          values.push_back(emitIntExpr(E));
         operation.addWaitOperands(builder.getContext(), clause.hasDevNumExpr(),
                                   values, lastDeviceTypeValues);
       }
@@ -549,7 +543,7 @@ class OpenACCClauseCIREmitter final
   void VisitDefaultAsyncClause(const OpenACCDefaultAsyncClause &clause) {
     if constexpr (isOneOfTypes<OpTy, mlir::acc::SetOp>) {
       operation.getDefaultAsyncMutable().append(
-          emitOpenACCIntExpr(clause.getIntExpr()));
+          emitIntExpr(clause.getIntExpr()));
     } else {
       llvm_unreachable("set, is only valid device_num constructs");
     }
@@ -639,7 +633,7 @@ class OpenACCClauseCIREmitter final
     if constexpr (isOneOfTypes<OpTy, mlir::acc::LoopOp>) {
       if (clause.hasIntExpr())
         operation.addWorkerNumOperand(builder.getContext(),
-                                      emitOpenACCIntExpr(clause.getIntExpr()),
+                                      emitIntExpr(clause.getIntExpr()),
                                       lastDeviceTypeValues);
       else
         operation.addEmptyWorker(builder.getContext(), lastDeviceTypeValues);
@@ -657,7 +651,7 @@ class OpenACCClauseCIREmitter final
     if constexpr (isOneOfTypes<OpTy, mlir::acc::LoopOp>) {
       if (clause.hasIntExpr())
         operation.addVectorOperand(builder.getContext(),
-                                   emitOpenACCIntExpr(clause.getIntExpr()),
+                                   emitIntExpr(clause.getIntExpr()),
                                    lastDeviceTypeValues);
       else
         operation.addEmptyVector(builder.getContext(), lastDeviceTypeValues);
@@ -693,7 +687,7 @@ class OpenACCClauseCIREmitter final
           } else if (isa<OpenACCAsteriskSizeExpr>(expr)) {
             values.push_back(createConstantInt(exprLoc, 64, -1));
           } else {
-            values.push_back(emitOpenACCIntExpr(expr));
+            values.push_back(emitIntExpr(expr));
           }
         }
 
@@ -728,5 +722,54 @@ auto makeClauseEmitter(OpTy &op, CIRGen::CIRGenFunction &cgf,
                        OpenACCDirectiveKind dirKind, SourceLocation dirLoc) {
   return OpenACCClauseCIREmitter<OpTy>(op, cgf, builder, dirKind, dirLoc);
 }
+} // namespace
+
+template <typename Op>
+void CIRGenFunction::emitOpenACCClauses(
+    Op &op, OpenACCDirectiveKind dirKind, SourceLocation dirLoc,
+    ArrayRef<const OpenACCClause *> clauses) {
+  mlir::OpBuilder::InsertionGuard guardCase(builder);
+
+  // Sets insertion point before the 'op', since every new expression needs to
+  // be before the operation.
+  builder.setInsertionPoint(op);
+  makeClauseEmitter(op, *this, builder, dirKind, dirLoc).emitClauses(clauses);
+}
+
+#define EXPL_SPEC(N)                                                           \
+  template void CIRGenFunction::emitOpenACCClauses<N>(                         \
+      N &, OpenACCDirectiveKind, SourceLocation,                               \
+      ArrayRef<const OpenACCClause *>);
+EXPL_SPEC(mlir::acc::ParallelOp)
+EXPL_SPEC(mlir::acc::SerialOp)
+EXPL_SPEC(mlir::acc::KernelsOp)
+EXPL_SPEC(mlir::acc::LoopOp)
+EXPL_SPEC(mlir::acc::DataOp)
+EXPL_SPEC(mlir::acc::InitOp)
+EXPL_SPEC(mlir::acc::ShutdownOp)
+EXPL_SPEC(mlir::acc::SetOp)
+EXPL_SPEC(mlir::acc::WaitOp)
+#undef EXPL_SPEC
+
+template <typename ComputeOp, typename LoopOp>
+void CIRGenFunction::emitOpenACCClauses(
+    ComputeOp &op, LoopOp &loopOp, OpenACCDirectiveKind dirKind,
+    SourceLocation dirLoc, ArrayRef<const OpenACCClause *> clauses) {
+  static_assert(std::is_same_v<mlir::acc::LoopOp, LoopOp>);
+
+  CombinedConstructClauseInfo<ComputeOp> inf{op, loopOp};
+  // We cannot set the insertion point here and do so in the emitter, but make
+  // sure we reset it with the 'guard' anyway.
+  mlir::OpBuilder::InsertionGuard guardCase(builder);
+  makeClauseEmitter(inf, *this, builder, dirKind, dirLoc).emitClauses(clauses);
+}
+
+#define EXPL_SPEC(N)                                                           \
+  template void CIRGenFunction::emitOpenACCClauses<N, mlir::acc::LoopOp>(      \
+      N &, mlir::acc::LoopOp &, OpenACCDirectiveKind, SourceLocation,          \
+      ArrayRef<const OpenACCClause *>);
 
-} // namespace clang
+EXPL_SPEC(mlir::acc::ParallelOp)
+EXPL_SPEC(mlir::acc::SerialOp)
+EXPL_SPEC(mlir::acc::KernelsOp)
+#undef EXPL_SPEC
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
index 3c18f5d9e205c..d922ca0c74d5d 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
@@ -12,12 +12,10 @@
 
 #include "CIRGenBuilder.h"
 #include "CIRGenFunction.h"
-#include "CIRGenOpenACCClause.h"
+#include "mlir/Dialect/OpenACC/OpenACC.h"
 #include "clang/AST/OpenACCClause.h"
 #include "clang/AST/StmtOpenACC.h"
 
-#include "mlir/Dialect/OpenACC/OpenACC.h"
-
 using namespace clang;
 using namespace clang::CIRGen;
 using namespace cir;
@@ -34,13 +32,7 @@ mlir::LogicalResult CIRGenFunction::emitOpenACCOpAssociatedStmt(
   llvm::SmallVector<mlir::Value> operands;
   auto op = builder.create<Op>(start, retTy, operands);
 
-  {
-    mlir::OpBuilder::InsertionGuard guardCase(builder);
-    // Sets insertion point before the 'op', since every new expression needs to
-    // be before the operation.
-    builder.setInsertionPoint(op);
-    makeClauseEmitter(op, *this, builder, dirKind, dirLoc).emitClauses(clauses);
-  }
+  emitOpenACCClauses(op, dirKind, dirLoc, clauses);
 
   {
     mlir::Block &block = op.getRegion().emplaceBlock();
@@ -108,14 +100,7 @@ mlir::LogicalResult CIRGenFunction::emitOpenACCOpCombinedConstruct(
       builder.create<mlir::acc::YieldOp>(end);
     }
 
-    {
-      mlir::OpBuilder::InsertionGuard guardCase(builder);
-      CombinedConstructClauseInfo<Op> inf{computeOp, loopOp};
-      // We don't bother setting the insertion point, since the clause emitter
-      // is going to have to do this correctly.
-      makeClauseEmitter(inf, *this, builder, dirKind, dirLoc)
-          .emitClauses(clauses);
-    }
+    emitOpenACCClauses(computeOp, loopOp, dirKind, dirLoc, clauses);
 
     builder.create<TermOp>(end);
   }
@@ -131,13 +116,7 @@ Op CIRGenFunction::emitOpenACCOp(
   llvm::SmallVector<mlir::Value> operands;
   auto op = builder.create<Op>(start, retTy, operands);
 
-  {
-    mlir::OpBuilder::InsertionGuard guardCase(builder);
-    // Sets insertion point before the 'op', since every new expression needs to
-    // be before the operation.
-    builder.setInsertionPoint(op);
-    makeClauseEmitter(op, *this, builder, dirKind, dirLoc).emitClauses(clauses);
-  }
+  emitOpenACCClauses(op, dirKind, dirLoc, clauses);
   return op;
 }
 
diff --git a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp
index 8a868fdc96350..24cd1d399de65 100644
--- a/clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp
@@ -12,9 +12,7 @@
 
 #include "CIRGenBuilder.h"
 #include "CIRGenFunction.h"
-#include "CIRGenOpenACCClause.h"
 
-#include "clang/AST/OpenACCClause.h"
 #include "clang/AST/StmtOpenACC.h"
 
 #include "mlir/Dialect/OpenACC/OpenACC.h"
@@ -89,15 +87,8 @@ CIRGenFunction::emitOpenACCLoopConstruct(const OpenACCLoopConstruct &s) {
   //
 
   // Emit all clauses.
-  {
-    mlir::OpBuilder::InsertionGuard guardCase(builder);
-    // Sets insertion point before the 'op', since every new expression needs to
-    // be before the operation.
-    builder.setInsertionPoint(op);
-    make...
[truncated]

Copy link
Contributor

@andykaylor andykaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@erichkeane erichkeane merged commit f171e05 into llvm:main May 19, 2025
14 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 20, 2025

LLVM Buildbot has detected a new failure on builder clang-x64-windows-msvc running on windows-gcebot2 while building clang at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/63/builds/6387

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/clang-windows.py ...' (failure)
...
  Passed           : 71058 (99.32%)
  Expectedly Failed:    37 (0.05%)
[76/77] Running the LLVM regression tests
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Program Files\Git\usr\bin
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using ld.lld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\ld.lld.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using lld-link: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\lld-link.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using ld64.lld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\ld64.lld.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using wasm-ld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\wasm-ld.exe
-- Testing: 58554 tests, 32 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: tools/dsymutil/X86/op-convert-offset.test (10071 of 58554)
******************** TEST 'LLVM :: tools/dsymutil/X86/op-convert-offset.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 23
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe -oso-prepend-path C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe' -oso-prepend-path 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset' -o 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# .---command stdout------------
# | warning: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2024-07-13 08:43:29.277066200) and debug map (2022-07-12 20:49:30.000000000)
# `-----------------------------
# RUN: at line 24
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix OBJ
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix OBJ
# RUN: at line 25
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix DSYM
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix DSYM
# RUN: at line 27
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe --linker parallel -oso-prepend-path C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs   C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset   -o C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe' --linker parallel -oso-prepend-path 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset' -o 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# .---command stdout------------
# | warning: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2024-07-13 08:43:29.277066200) and debug map (2022-07-12 20:49:30.000000000)
# | warning: cann't read address attribute value.
# | note: while processing op-convert-offset1.c
# `-----------------------------
# RUN: at line 30
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe    C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1    | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix OBJ
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix OBJ
# RUN: at line 33
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix DSYM
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix DSYM
# .---command stderr------------
# | C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test:45:7: error: DSYM: expected string not found in input
# | DSYM: 0x00000084: DW_TAG_base_type
Step 8 (stage 1 check) failure: stage 1 check (failure)
...
  Passed           : 71058 (99.32%)
  Expectedly Failed:    37 (0.05%)
[76/77] Running the LLVM regression tests
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:57: note: using lit tools: C:\Program Files\Git\usr\bin
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using ld.lld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\ld.lld.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using lld-link: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\lld-link.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using ld64.lld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\ld64.lld.exe
llvm-lit.py: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\utils\lit\lit\llvm\config.py:520: note: using wasm-ld: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\wasm-ld.exe
-- Testing: 58554 tests, 32 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 
FAIL: LLVM :: tools/dsymutil/X86/op-convert-offset.test (10071 of 58554)
******************** TEST 'LLVM :: tools/dsymutil/X86/op-convert-offset.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 23
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe -oso-prepend-path C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe' -oso-prepend-path 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset' -o 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# .---command stdout------------
# | warning: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2024-07-13 08:43:29.277066200) and debug map (2022-07-12 20:49:30.000000000)
# `-----------------------------
# RUN: at line 24
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix OBJ
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix OBJ
# RUN: at line 25
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix DSYM
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix DSYM
# RUN: at line 27
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe --linker parallel -oso-prepend-path C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs   C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset   -o C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\dsymutil.exe' --linker parallel -oso-prepend-path 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset' -o 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# .---command stdout------------
# | warning: C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2024-07-13 08:43:29.277066200) and debug map (2022-07-12 20:49:30.000000000)
# | warning: cann't read address attribute value.
# | note: while processing op-convert-offset1.c
# `-----------------------------
# RUN: at line 30
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe    C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1    | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix OBJ
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix OBJ
# RUN: at line 33
c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM 2>&1 | c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test --check-prefix DSYM
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\llvm-dwarfdump.exe' 'C:\b\slave\clang-x64-windows-msvc\build\stage1\test\tools\dsymutil\X86\Output\op-convert-offset.test.tmp.dSYM'
# executed command: 'c:\b\slave\clang-x64-windows-msvc\build\stage1\bin\filecheck.exe' 'C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test' --check-prefix DSYM
# .---command stderr------------
# | C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\test\tools\dsymutil\X86\op-convert-offset.test:45:7: error: DSYM: expected string not found in input
# | DSYM: 0x00000084: DW_TAG_base_type

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 20, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu-no-asserts running on doug-worker-6 while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/202/builds/1330

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/dsymutil/X86/op-convert-offset.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
warning: /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-03-11 17:27:45.671531848) and debug map (2022-07-12 20:49:30.000000000)
warning: /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-03-11 17:27:45.671531848) and debug map (2022-07-12 20:49:30.000000000)
warning: cann't read address attribute value.
note: while processing op-convert-offset1.c

--
Command Output (stderr):
--
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/dsymutil -oso-prepend-path /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 23
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/dsymutil -oso-prepend-path /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1 | /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 24
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 25
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/dsymutil --linker parallel -oso-prepend-path /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs   /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset   -o /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 27
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/dsymutil --linker parallel -oso-prepend-path /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump    /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1    | /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 30
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
/home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 33
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/llvm-dwarfdump /home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /home/buildbot/buildbot-root/gcc-no-asserts/build/bin/FileCheck /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
�[1m/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test:45:7: �[0m�[0;1;31merror: �[0m�[1mDSYM: expected string not found in input
�[0mDSYM: 0x00000084: DW_TAG_base_type
�[0;1;32m      ^
�[0m�[1m<stdin>:1:1: �[0m�[0;1;30mnote: �[0m�[1mscanning from here
�[0m/home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM/Contents/Resources/DWARF/op-convert-offset: file format Mach-O 64-bit x86-64
�[0;1;32m^
�[0m�[1m<stdin>:16:1: �[0m�[0;1;30mnote: �[0m�[1mpossible intended match here
�[0m0x0000001e: DW_TAG_base_type
�[0;1;32m^
�[0m
Input file: <stdin>
Check file: /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m            1: �[0m�[1m�[0;1;46m/home/buildbot/buildbot-root/gcc-no-asserts/build/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM/Contents/Resources/DWARF/op-convert-offset: file format Mach-O 64-bit x86-64 �[0m
�[0;1;31mcheck:45'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
�[0m�[0;1;30m            2: �[0m�[1m�[0;1;46m �[0m
�[0;1;31mcheck:45'0     ~
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 20, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building clang at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/64/builds/3688

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'lit :: timeout-hang.py' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 13
not env -u FILECHECK_OPTS "/home/llvm/llvm-external-buildbots/workers/env/bin/python3.11" /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt  --timeout=1 --param external=0 | "/home/llvm/llvm-external-buildbots/workers/env/bin/python3.11" /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/utils/lit/tests/timeout-hang.py 1
# executed command: not env -u FILECHECK_OPTS /home/llvm/llvm-external-buildbots/workers/env/bin/python3.11 /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit.py -j1 --order=lexical Inputs/timeout-hang/run-nonexistent.txt --timeout=1 --param external=0
# .---command stderr------------
# | lit.py: /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 1 seconds was requested on the command line. Forcing timeout to be 1 seconds.
# `-----------------------------
# executed command: /home/llvm/llvm-external-buildbots/workers/env/bin/python3.11 /home/llvm/llvm-external-buildbots/workers/aix-ppc64/clang-ppc64-aix/build/utils/lit/tests/timeout-hang.py 1
# .---command stdout------------
# | Testing took as long or longer than timeout
# `-----------------------------
# error: command failed with exit status: 1

--

********************


sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Having the whole clause emission be in a header file ended up being
pragmatic, but ended up being a sizable negative for a variety of
reasons. This patch moves it to its own .cpp file and makes
CIRGenFunction instead call into the visitor via a template instead.

This is possible because the valid list of construct kinds is quite
finite, and easy to enumerate.
ajaden-codes pushed a commit to Jaddyen/llvm-project that referenced this pull request Jun 6, 2025
Having the whole clause emission be in a header file ended up being
pragmatic, but ended up being a sizable negative for a variety of
reasons. This patch moves it to its own .cpp file and makes
CIRGenFunction instead call into the visitor via a template instead.

This is possible because the valid list of construct kinds is quite
finite, and easy to enumerate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants