[flang-commits] [flang] [llvm] [mlir] [Flang][OpenMP] Add nsw flags to OMPIRBuilder loop IV arithmetic (PR #214165)

Kaviya Rajendiran via flang-commits flang-commits at lists.llvm.org
Thu Aug 6 02:04:01 PDT 2026


================
@@ -5808,7 +5808,8 @@ CanonicalLoopInfo *OpenMPIRBuilder::createLoopSkeleton(
 
   Builder.SetInsertPoint(Latch);
   Value *Next = Builder.CreateAdd(IndVarPHI, ConstantInt::get(IndVarTy, 1),
-                                  "omp_" + Name + ".next", /*HasNUW=*/true);
+                                  "omp_" + Name + ".next", /*HasNUW=*/true,
+                                  /*HasNSW=*/Config.hasNoSignedWrap());
----------------
kaviya2510 wrote:

Thanks for the testcase. I have incorporated a check to detect compile-time constant trip counts that exceed the `INT_MAX` limit and avoid adding `nsw` flag for those scenarios.

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


More information about the flang-commits mailing list