[Mlir-commits] [flang] [mlir] [OpenMP][Flang][MLIR] Skip trip count calculation when bounds are null (PR #176469)

Sergio Afonso llvmlistbot at llvm.org
Mon Jan 19 04:39:07 PST 2026


================
@@ -6314,6 +6314,9 @@ initTargetRuntimeAttrs(llvm::IRBuilderBase &builder,
       llvm::Value *upperBound = moduleTranslation.lookupValue(loopUpper);
       llvm::Value *step = moduleTranslation.lookupValue(loopStep);
 
+      if (!lowerBound || !upperBound || !step)
+        continue;
----------------
skatrak wrote:

If we find ourselves in this situation, I think the best course of action would be to entirely avoid setting a trip count, rather than potentially pass a wrong/incomplete value.
```suggestion
      if (!lowerBound || !upperBound || !step) {
        attrs.LoopTripCount = nullptr;
        break;
      }
```

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


More information about the Mlir-commits mailing list