[llvm] r274847 - Addressing post-commit comments regarding not expanding UDIV;

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 8 07:17:09 PDT 2016


Author: sjoerdmeijer
Date: Fri Jul  8 09:17:09 2016
New Revision: 274847

URL: http://llvm.org/viewvc/llvm-project?rev=274847&view=rev
Log:
Addressing post-commit comments regarding not expanding UDIV;
we don't expand only when compiling for minimum code size.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/ARM/urem-opt-size.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=274847&r1=274846&r2=274847&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Jul  8 09:17:09 2016
@@ -14516,9 +14516,9 @@ SDValue DAGCombiner::BuildSDIVPow2(SDNod
 /// number.
 /// Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's Guide".
 SDValue DAGCombiner::BuildUDIV(SDNode *N) {
-  // when optimising for size, we don't want to expand a div to a mul and
+  // when optimising for minimum size, we don't want to expand a div to a mul
   // and a shift.
-  if (ForCodeSize)
+  if (DAG.getMachineFunction().getFunction()->optForMinSize())
     return SDValue();
 
   ConstantSDNode *C = isConstOrConstSplat(N->getOperand(1));

Modified: llvm/trunk/test/CodeGen/ARM/urem-opt-size.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/urem-opt-size.ll?rev=274847&r1=274846&r2=274847&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/urem-opt-size.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/urem-opt-size.ll Fri Jul  8 09:17:09 2016
@@ -1,4 +1,4 @@
-; When optimising for size, we don't want to expand a div to a mul and
+; When optimising for minimum size, we don't want to expand a udiv to a mul
 ; and a shift sequence. As a result, the urem instruction will not be
 ; expanded to a sequence of umull, lsrs, muls and sub instructions, but
 ; just a call to __aeabi_uidivmod.




More information about the llvm-commits mailing list