[PATCH] D97160: [DAGCombiner] Optimize SMULO/UMULO if we can prove that overflow is impossible.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 24 11:07:34 PST 2021


craig.topper added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4672
+      bool Overflow;
+      (void)N0Known.getMaxValue().umul_ov(N1Known.getMaxValue(), Overflow);
+      if (!Overflow)
----------------
RKSimon wrote:
> Is it worth moving this to something like:
> ```
> KnownBits KnownBits::umul_ov(const KnownBits &LHS,const KnownBits &RHS,llvm:Optional<bool> &Overflow)
> ```
Are you suggesting to merge this with computeForMul? Just calling APInt::umul_ov doesn't give you the right known bits for the data result. So we would need the logic from computeForMul.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97160



More information about the llvm-commits mailing list