[Mlir-commits] [mlir] [mlir][scf] Add parallelLoopUnrollByFactors()	(PR #163806)
    llvmlistbot at llvm.org 
    llvmlistbot at llvm.org
       
    Thu Oct 23 04:05:03 PDT 2025
    
    
  
================
@@ -1544,3 +1558,107 @@ bool mlir::isPerfectlyNestedForLoops(
   }
   return true;
 }
+
+std::optional<llvm::APSInt> mlir::scf::computeUbMinusLb(Value lb, Value ub,
+                                                        bool isSigned) {
+  llvm::APSInt diff;
+  auto addOp = ub.getDefiningOp<arith::AddIOp>();
+  if (!addOp)
+    return std::nullopt;
+  if ((isSigned && !addOp.hasNoSignedWrap()) ||
+      (!isSigned && !addOp.hasNoUnsignedWrap()))
+    return std::nullopt;
+
+  if (addOp.getLhs() != lb ||
+      !matchPattern(addOp.getRhs(), m_ConstantInt(&diff)))
+    return std::nullopt;
+  return diff;
+}
+
+llvm::SmallVector<int64_t>
+getConstLoopTripCounts(mlir::LoopLikeOpInterface loopOp) {
+  auto loBnds = loopOp.getLoopLowerBounds();
+  auto upBnds = loopOp.getLoopUpperBounds();
+  auto steps = loopOp.getLoopSteps();
----------------
fabrizio-indirli wrote:
Done
https://github.com/llvm/llvm-project/pull/163806
    
    
More information about the Mlir-commits
mailing list