[clang] [CIR][OpenMP] Implement lowering for the 'num_threads' clause for 'parallel' directive (PR #202466)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 20:59:15 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c -- clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp clang/test/CIR/CodeGenOpenMP/parallel.c --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp b/clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp
index 736cc8e1b..216bb8671 100644
--- a/clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenOpenMPClause.cpp
@@ -70,24 +70,23 @@ public:
if constexpr (std::is_same_v<OpTy, mlir::omp::ParallelOp>) {
Expr *numThreadsExpr = clause->getNumThreads();
mlir::Value numThreadsValue = cgf.emitScalarExpr(numThreadsExpr);
- mlir::Location numThreadsLoc = cgf.cgm.getLoc(numThreadsExpr->getBeginLoc());
+ mlir::Location numThreadsLoc =
+ cgf.cgm.getLoc(numThreadsExpr->getBeginLoc());
- cir::IntType cirIntType = mlir::cast<cir::IntType>(numThreadsValue.getType());
+ cir::IntType cirIntType =
+ mlir::cast<cir::IntType>(numThreadsValue.getType());
mlir::Type stdIntType = builder.getIntegerType(cirIntType.getWidth());
- mlir::Value unrealizedCastNumThreads = mlir::UnrealizedConversionCastOp::create(
- builder,
- numThreadsLoc,
- stdIntType,
- numThreadsValue
- ).getResult(0);
+ mlir::Value unrealizedCastNumThreads =
+ mlir::UnrealizedConversionCastOp::create(builder, numThreadsLoc,
+ stdIntType, numThreadsValue)
+ .getResult(0);
operation.getNumThreadsVarsMutable().append(unrealizedCastNumThreads);
} else {
cgf.cgm.errorNYI(
- clause->getBeginLoc(),
- "OMPNumThreadsClause unimplemented on this directive kind"
- );
+ clause->getBeginLoc(),
+ "OMPNumThreadsClause unimplemented on this directive kind");
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/202466
More information about the cfe-commits
mailing list