[llvm-branch-commits] [flang] [mlir] [mlir][flang][OpenMP] Select depend and affinity iterators per locator (PR #227454)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 6 19:16:30 PDT 2026


================
@@ -2899,11 +2899,18 @@ class IteratorInfo {
       upperBounds[d] = ub;
       steps[d] = st;
 
-      // trips = ((ub - lb) / step) + 1  (inclusive ub, assume positive step)
-      llvm::Value *diff = builder.CreateSub(ub, lb);
-      llvm::Value *div = builder.CreateSDiv(diff, st);
-      trips[d] = builder.CreateAdd(
-          div, llvm::ConstantInt::get(builder.getInt64Ty(), 1));
+      // Use a direction-aware count so an empty range contributes no entries.
+      // Widen before subtracting bounds: valid i64 endpoints can have a span
+      // that does not fit in signed i64.
+      llvm::Type *countTy = builder.getIntNTy(65);
----------------
MattPD wrote:

The `integer(16)` reproducer now produces three dependences at the expected locations: `a(1)`, `a(2)`, and `a(3)`.

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


More information about the llvm-branch-commits mailing list