[Mlir-commits] [mlir] [mlir][SCF] Avoid generating unnecessary div/rem operations during coalescing (PR #91562)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu May 9 14:50:01 PDT 2024
================
@@ -562,19 +575,43 @@ static Value getProductOfIntsOrIndexes(RewriterBase &rewriter, Location loc,
static std::pair<SmallVector<Value>, SmallPtrSet<Operation *, 2>>
delinearizeInductionVariable(RewriterBase &rewriter, Location loc,
Value linearizedIv, ArrayRef<Value> ubs) {
- Value previous = linearizedIv;
SmallVector<Value> delinearizedIvs(ubs.size());
SmallPtrSet<Operation *, 2> preservedUsers;
- for (unsigned i = 0, e = ubs.size(); i < e; ++i) {
- unsigned idx = ubs.size() - i - 1;
- if (i != 0) {
+
+ llvm::BitVector isUbOne(ubs.size());
+ for (auto [index, ub] : llvm::enumerate(ubs)) {
+ auto ubCst = getConstantIntValue(ub);
+ if (ubCst && ubCst.value() == 1)
+ isUbOne.set(index);
+ }
----------------
MaheshRavishankar wrote:
Yup...
https://github.com/llvm/llvm-project/pull/91562
More information about the Mlir-commits
mailing list