[Mlir-commits] [mlir] 9390b8d - [MLIR][Presburger] MPInt: add missing fastpath in ceilDiv

Arjun P llvmlistbot at llvm.org
Fri Jul 15 09:26:35 PDT 2022


Author: Arjun P
Date: 2022-07-15T17:26:37+01:00
New Revision: 9390b8d34ce3a7f2bad33672ea8089e0b26e1f91

URL: https://github.com/llvm/llvm-project/commit/9390b8d34ce3a7f2bad33672ea8089e0b26e1f91
DIFF: https://github.com/llvm/llvm-project/commit/9390b8d34ce3a7f2bad33672ea8089e0b26e1f91.diff

LOG: [MLIR][Presburger] MPInt: add missing fastpath in ceilDiv

This is not a bug in functionality, just a missed optimization.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D129815

Added: 
    

Modified: 
    mlir/include/mlir/Analysis/Presburger/MPInt.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Analysis/Presburger/MPInt.h b/mlir/include/mlir/Analysis/Presburger/MPInt.h
index 85288f82cd09..a979107cd7c1 100644
--- a/mlir/include/mlir/Analysis/Presburger/MPInt.h
+++ b/mlir/include/mlir/Analysis/Presburger/MPInt.h
@@ -362,6 +362,7 @@ LLVM_ATTRIBUTE_ALWAYS_INLINE MPInt ceilDiv(const MPInt &lhs, const MPInt &rhs) {
   if (LLVM_LIKELY(lhs.isSmall() && rhs.isSmall())) {
     if (LLVM_UNLIKELY(detail::divWouldOverflow(lhs.getSmall(), rhs.getSmall())))
       return -lhs;
+    return MPInt(mlir::ceilDiv(lhs.getSmall(), rhs.getSmall()));
   }
   return MPInt(ceilDiv(detail::SlowMPInt(lhs), detail::SlowMPInt(rhs)));
 }


        


More information about the Mlir-commits mailing list