================
@@ -10737,16 +10741,29 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr 
*CollapseLoopCountExpr,
       }
 
       // Build final: IS.CounterVar = IS.Start + IS.NumIters * IS.Step
-      ExprResult Final =
-          buildCounterUpdate(SemaRef, CurScope, UpdLoc, CounterVar,
-                             IS.CounterInit, IS.NumIterations, IS.CounterStep,
-                             IS.Subtract, IS.IsNonRectangularLB, &Captures);
-      if (!Final.isUsable()) {
-        HasErrors = true;
-        break;
+      // For loop transformation directives with arithmetic counters, use
+      // (NumIters - 1) to get the value from the last iteration, not the loop
+      // exit value. For iterator-based loops (range-based for or explicit
+      // iterator loops), skip finalization entirely.
----------------
alexey-bataev wrote:

```suggestion
      // For iterator-based loops (range-based for or explicit
      // iterator loops) in loop transformation directives, skip
      // finalization entirely.
```

https://github.com/llvm/llvm-project/pull/214717
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to