[PATCH] D50222: [CodeGen] [SelectionDAG] More efficient code for X % C == 0
Dmytro Shynkevych via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 20 00:12:10 PDT 2018
hermord marked 4 inline comments as done.
hermord added inline comments.
================
Comment at: lib/CodeGen/SelectionDAG/TargetLowering.cpp:3633-3634
+ unsigned W = D.getBitWidth();
+ // The algorithm implemented below assumes D > 1
+ // We use the fact that N % D == 0 <=> N % |D| == 0 to guarantee this
+ if (IsSigned && D.isNegative())
----------------
lebedev.ri wrote:
> Add self-explanatory assertion?
Sorry, I couldn't figure out what the assertion should be. The negative case can still be handled just fine; do you mean that I should assert (D0 =/= 1) and then make the caller check for that?
Repository:
rL LLVM
https://reviews.llvm.org/D50222
More information about the llvm-commits
mailing list