[clang] [llvm] [openmp] [CLANG][OpenMP] Restore loop variable values after transformation directives (PR #214717)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 07:12:26 PDT 2026
================
@@ -11220,16 +11223,27 @@ 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 class-type iterator loops (non-arithmetic, non-pointer counters)
+ // in loop transformation directives, skip finalization — arithmetic on
+ // such iterators is not expressible via buildCounterUpdate.
+ ExprResult Final;
+ bool IsClassIteratorLoop =
+ !IS.CounterVar->getType()->isArithmeticType() &&
+ !IS.CounterVar->getType()->isPointerType();
+ if (IsClassIteratorLoop && isOpenMPLoopTransformationDirective(DKind)) {
+ Final = nullptr;
----------------
alexey-bataev wrote:
```suggestion
// FIXME: finalize class-type iterators too (random-access arithmetic
// is available per the canonical loop form).
Final = nullptr;
```
https://github.com/llvm/llvm-project/pull/214717
More information about the llvm-commits
mailing list