[clang] [CIR][OpenMP] Implement lowering for the 'if' clause for 'parallel' d… (PR #204999)

Andy Kaylor via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 30 09:30:31 PDT 2026


================
@@ -93,6 +93,29 @@ bool OpenMPClauseEmitter::emitProcBind(
   return false;
 }
 
+bool OpenMPClauseEmitter::emitIf(mlir::omp::IfClauseOps &result) const {
+  for (const OMPClause *clause : clauses) {
+    const auto *ic = dyn_cast<OMPIfClause>(clause);
+    if (!ic)
+      continue;
+
+    Expr *ifCondition = ic->getCondition();
+    mlir::Value ifBoolValue = cgf.evaluateExprAsBool(ifCondition); // !cir.bool
+
+    mlir::Type uIntType = builder.getUIntNTy(1);
+    mlir::Value ifUIntValue =
+        builder.createBoolToInt(ifBoolValue, uIntType); // u1
----------------
andykaylor wrote:

Why can't the bool-to-int cast convert to a signed i1?

https://github.com/llvm/llvm-project/pull/204999


More information about the cfe-commits mailing list