We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1.
Turns out scalar evolution does divide by 1 sometimes in getRangeForAffineARHelper so this could be a slight compile time improvement.
Paths
| Differential D33154
[APInt] Add early outs for a division by 1 to udiv/urem/udivrem ClosedPublic Authored by craig.topper on May 12 2017, 2:31 PM.
Details Summary We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1. Turns out scalar evolution does divide by 1 sometimes in getRangeForAffineARHelper so this could be a slight compile time improvement.
Diff Detail
Event TimelineThis revision is now accepted and ready to land.May 12 2017, 2:40 PM Closed by commit rL302953: [APInt] Add early outs for a division by 1 to udiv/urem/udivrem (authored by ctopper). · Explain WhyMay 12 2017, 2:59 PM This revision was automatically updated to reflect the committed changes.
Diff 98852 llvm/trunk/lib/Support/APInt.cpp
|