================
@@ -325,13 +415,22 @@ emitOMPWorksharingLoop(CIRGenFunction &cgf, const
OMPLoopDirective &s,
vd, addPrivateCounter(cgf, cgm, loc, privateVd, clauseOps));
}
- mlir::Value tripCountCir = cgf.emitScalarExpr(s.getNumIterations());
- auto cirIntType = mlir::cast<cir::IntType>(tripCountCir.getType());
- mlir::Value zero = builder.createBuiltinIntCast(
- loc, builder.getConstInt(loc, cirIntType, 0));
- mlir::Value one = builder.createBuiltinIntCast(
- loc, builder.getConstInt(loc, cirIntType, 1));
- mlir::Value tripCount = builder.createBuiltinIntCast(loc, tripCountCir);
+ mlir::Value zero, tripCount, one;
+ if (consumingHostEval) {
+ // Consume the host_eval bounds forwarded by the enclosing omp.target.
+ cgf.ompHostEvalBounds->applied = true;
+ zero = cgf.ompHostEvalBounds->zero;
+ tripCount = cgf.ompHostEvalBounds->tripCount;
+ one = cgf.ompHostEvalBounds->one;
+ } else {
+ mlir::Value tripCountCir = cgf.emitScalarExpr(s.getNumIterations());
+ auto cirIntType = mlir::cast<cir::IntType>(tripCountCir.getType());
----------------
erichkeane wrote:
without removing the 0/1 here, it seems awkward to have this all re-created
here. Disregard if we're only calculating the trip-count, but we should
probably split this into a function otherwise (maybe the ompHostEvalBounds
function of some sort?).
https://github.com/llvm/llvm-project/pull/229259
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits