[Mlir-commits] [clang] [llvm] [mlir] [openmp] [Clang][OpenMP] Canonicalize Intra-tiles in Loop Tiling (PR #191114)

Michael Kruse llvmlistbot at llvm.org
Fri Aug 28 04:37:37 PDT 2026


================
@@ -10621,6 +10682,36 @@ checkOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
       SourceLocation UpdLoc = IS.IncSrcRange.getBegin();
       ExprResult Iter;
 
+      // Wire the reinterpreted lower bound to its floor dependence (see design
+      // note in ActOnOpenMPTileDirective).
+      if (IS.ReinterpretTileLB && IS.CounterInit) {
+        bool FoundFloor = false;
+        if (const auto *LBRef =
+                dyn_cast<DeclRefExpr>(IS.CounterInit->IgnoreParenImpCasts())) {
+          const Decl *FloorDecl = LBRef->getDecl()->getCanonicalDecl();
+          for (unsigned K = 0; K < Cnt; ++K) {
+            const auto *CV = dyn_cast_or_null<DeclRefExpr>(Built.Counters[K]);
+            if (CV && CV->getDecl()->getCanonicalDecl() == FloorDecl) {
+              IS.IsNonRectangularLB = true;
+              IS.LoopDependentIdx = K + 1;
----------------
Meinersbur wrote:

Can we avoid introducing `ReinterpretTileLB` and set these directly in `checkOpenMPIterationSpace`? Modifying `IS` after `checkOpenMPIterationSpace` has already computed it is kind-of an anti-pattern.

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


More information about the Mlir-commits mailing list