[PATCH] D12082: [X86] Do not lower scalar sdiv/udiv to a shifts + mul sequence when optimizing for minsize
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 07:43:55 PDT 2015
spatel accepted this revision.
spatel added a comment.
This revision is now accepted and ready to land.
A couple of nits in the comments. Otherwise, LGTM.
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2188
@@ -2186,4 +2187,3 @@
(-N1C->getAPIntValue()).isPowerOf2())) {
- // If dividing by powers of two is cheap, then don't perform the following
- // fold.
- if (TLI.isPow2SDivCheap())
+ // If integer division is cheap, then don't perform the following fold
+ if (TLI.isIntDivCheap(N->getValueType(0), MinSize))
----------------
Missing period.
================
Comment at: lib/Target/X86/X86ISelLowering.cpp:26428-26431
@@ +26427,6 @@
+ // Integer division on x86 is expensive. However, when aggressively optimizing
+ // for code size, we prefer to leave the div as is, as it is usually smaller
+ // than the alternative sequence.
+ // The exception to this is vector divs. Since we don't have vector integer
+ // division, leaving the div as-is is a loss even in terms of size, because it
+ // will have to be scalarized, while the alternative code sequence can be
----------------
Use "division" in these lines rather than "div"
http://reviews.llvm.org/D12082
More information about the llvm-commits
mailing list