[Mlir-commits] [mlir] [mlir][OpenACC] Normalize loop bounds in convertACCLoopToSCFFor for negative steps (PR #184935)

Razvan Lupusoru llvmlistbot at llvm.org
Fri Mar 6 10:02:09 PST 2026


================
@@ -201,13 +201,24 @@ wrapMultiBlockRegionWithSCFExecuteRegion(Region &region, IRMapping &mapping,
   return exeRegionOp;
 }
 
+/// Return true if \p v is a constant index with a negative value.
+static bool isNegativeConstantIndex(Value v) {
+  if (auto cst = v.getDefiningOp<arith::ConstantIndexOp>())
+    return cst.value() < 0;
+  if (auto cst = v.getDefiningOp<arith::ConstantOp>())
+    if (auto intAttr = dyn_cast<IntegerAttr>(cst.getValue()))
+      return intAttr.getInt() < 0;
+  return false;
+}
----------------
razvanlupusoru wrote:

+1

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


More information about the Mlir-commits mailing list