summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSteve King <steve@metrokings.com>2015-08-25 02:31:21 +0000
committerSteve King <steve@metrokings.com>2015-08-25 02:31:21 +0000
commit5cdbd20cc335f8bd4762e929b8c3658ee531318f (patch)
treefaff8b1358d910919faab4bc7c2983b55e6a4d27 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent9b33e28270a2796ed434de8c43ddb7d1a7daa5fa (diff)
downloadbcm5719-llvm-5cdbd20cc335f8bd4762e929b8c3658ee531318f.tar.gz
bcm5719-llvm-5cdbd20cc335f8bd4762e929b8c3658ee531318f.zip
Pass function attributes instead of boolean in isIntDivCheap().
llvm-svn: 245921
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index bd02b1e156b..3275daf3ffd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -2183,7 +2183,6 @@ SDValue DAGCombiner::visitSDIV(SDNode *N) {
N0, N1);
}
- bool MinSize = DAG.getMachineFunction().getFunction()->optForMinSize();
// fold (sdiv X, pow2) -> simple ops after legalize
// FIXME: We check for the exact bit here because the generic lowering gives
// better results in that case. The target-specific lowering should learn how
@@ -2192,10 +2191,6 @@ SDValue DAGCombiner::visitSDIV(SDNode *N) {
!cast<BinaryWithFlagsSDNode>(N)->Flags.hasExact() &&
(N1C->getAPIntValue().isPowerOf2() ||
(-N1C->getAPIntValue()).isPowerOf2())) {
- // If integer division is cheap, then don't perform the following fold.
- if (TLI.isIntDivCheap(N->getValueType(0), MinSize))
- return SDValue();
-
// Target-specific implementation of sdiv x, pow2.
if (SDValue Res = BuildSDIVPow2(N))
return Res;
@@ -2232,8 +2227,10 @@ SDValue DAGCombiner::visitSDIV(SDNode *N) {
}
// If integer divide is expensive and we satisfy the requirements, emit an
- // alternate sequence.
- if (N1C && !TLI.isIntDivCheap(N->getValueType(0), MinSize))
+ // alternate sequence. Targets may check function attributes for size/speed
+ // trade-offs.
+ AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes();
+ if (N1C && !TLI.isIntDivCheap(N->getValueType(0), Attr))
if (SDValue Op = BuildSDIV(N))
return Op;
@@ -2289,8 +2286,8 @@ SDValue DAGCombiner::visitUDIV(SDNode *N) {
}
// fold (udiv x, c) -> alternate
- bool MinSize = DAG.getMachineFunction().getFunction()->optForMinSize();
- if (N1C && !TLI.isIntDivCheap(N->getValueType(0), MinSize))
+ AttributeSet Attr = DAG.getMachineFunction().getFunction()->getAttributes();
+ if (N1C && !TLI.isIntDivCheap(N->getValueType(0), Attr))
if (SDValue Op = BuildUDIV(N))
return Op;
OpenPOWER on IntegriCloud