[PATCH] D109515: [AggressiveInstCombine] Add `udiv` and `urem` instrs to TruncInstCombine DAG

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 9 09:37:39 PDT 2021


lebedev.ri added a comment.

Seems reasonable.



================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp:151
+      // 2. phi node(and loop handling)
       // ...
       return false;
----------------
sdiv, srem; see b289dc530632613edb3eb067895c1981cb77ccd0.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp:314-323
+      KnownBits KnownLHS = computeKnownBits(I->getOperand(0));
+      unsigned MinBitWidth = KnownLHS.getMaxValue().getActiveBits();
+      if (MinBitWidth >= OrigBitWidth)
+        return nullptr;
+      KnownBits KnownRHS = computeKnownBits(I->getOperand(1));
+      MinBitWidth =
+          std::max(MinBitWidth, KnownRHS.getMaxValue().getActiveBits());
----------------



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109515/new/

https://reviews.llvm.org/D109515



More information about the llvm-commits mailing list