================
@@ -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
----------------
pedropiin wrote:
Yes we do need to `u1` before `i1`.
The `cir.builtin_int_cast` needs an Integer-typed value as input, therefore we
can't use `cir.bool` directly. And we can't use the `u1` directly as the value
of the `if clause` needs to be a `mlir::IntegerType`. So, to my knowledge, the
only way we can get a `mlir::IntegerType` from a boolean currently is through
this 2-step conversion.
https://github.com/llvm/llvm-project/pull/204999
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits