[PATCH] D65366: [CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 02:05:11 PDT 2019


lebedev.ri added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5009
+    // Q = floor((2 * A) / (2^K))
+    APInt Q = (3 * A).udiv(APInt::getOneBitSet(W, K));
+
----------------
lebedev.ri wrote:
> craig.topper wrote:
> > Is there a trick here or is one of these a typo? The comment says 2*A and the code says 3*A.
> This is a bug, i was trying to see if this would trigger any failures in test-suite (i think it didn't),
> and forgot to tidy the diff before posting :/
Double-checked, and indeed this does not break test-suite.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65366





More information about the llvm-commits mailing list