summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSjoerd Meijer <sjoerd.meijer@arm.com>2016-07-08 15:32:01 +0000
committerSjoerd Meijer <sjoerd.meijer@arm.com>2016-07-08 15:32:01 +0000
commit1ee119f897125df5df7acaec00103e86da46898e (patch)
treeaa28b1cc23863b32fa02ac1074d4af691b1e936b /llvm/lib
parent50ecf5de016df669b85241ab55a66f80c0443ac5 (diff)
downloadbcm5719-llvm-1ee119f897125df5df7acaec00103e86da46898e.tar.gz
bcm5719-llvm-1ee119f897125df5df7acaec00103e86da46898e.zip
Do not expand SDIV when compiling for minimum code size
Differential Revision: http://reviews.llvm.org/D22139 llvm-svn: 274855
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 2931ad276a4..3a67fe4ec9d 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14475,6 +14475,11 @@ SDValue DAGCombiner::SimplifySetCC(EVT VT, SDValue N0, SDValue N1,
/// by a magic number.
/// Ref: "Hacker's Delight" or "The PowerPC Compiler Writer's Guide".
SDValue DAGCombiner::BuildSDIV(SDNode *N) {
+ // when optimising for minimum size, we don't want to expand a div to a mul
+ // and a shift.
+ if (DAG.getMachineFunction().getFunction()->optForMinSize())
+ return SDValue();
+
ConstantSDNode *C = isConstOrConstSplat(N->getOperand(1));
if (!C)
return SDValue();
OpenPOWER on IntegriCloud