[PATCH] D26699: [BypassSlowDivision] Handle division by constant numerators properly.

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 14:23:30 PST 2016


tra added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/BypassSlowDivision.cpp:86-87
 
   if (isa<ConstantInt>(Divisor) ||
       (isa<ConstantInt>(Dividend) && isa<ConstantInt>(Divisor))) {
     // Operations with immediate values should have
----------------
This condition appears to be tautological.
AFAICT, it's equivalent to just if(isa<ConstantInt>(Divisor)).


================
Comment at: llvm/lib/Transforms/Utils/BypassSlowDivision.cpp:160
+
+  // We bailed out above that the divisor is not a constant, but the dividend
+  // may still be a constant.  Set OrV to our non-constant operands OR'ed
----------------
This does not parse.
Perhaps it was meant to be "We ensured above" or "We bailed out above if divisor *was* constant".


================
Comment at: llvm/lib/Transforms/Utils/BypassSlowDivision.cpp:163
+  // together.
+  assert(!isa<ConstantInt>(Divisor));
+
----------------
Given that we do bail out on all constant divisors, this assert seems to be a bit redundant.


https://reviews.llvm.org/D26699





More information about the llvm-commits mailing list