forked from OSchip/llvm-project
[SelectionDAG] Add the option of disabling generic combines.
Summary: For some targets generic combines don't really do much and they consume a disproportionate amount of time. There's not really a mechanism in SDISel to tactically disable combines, but we can have a switch to disable all of them and let the targets just implement what they specifically need. Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79112
This commit is contained in:
parent
0c148430cf
commit
dbaed589ab
|
@ -160,6 +160,11 @@ public:
|
||||||
virtual bool generateFMAsInMachineCombiner(CodeGenOpt::Level OptLevel) const {
|
virtual bool generateFMAsInMachineCombiner(CodeGenOpt::Level OptLevel) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return true if the DAG Combiner should disable generic combines.
|
||||||
|
virtual bool disableGenericCombines(CodeGenOpt::Level OptLevel) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
|
@ -130,12 +130,14 @@ namespace {
|
||||||
class DAGCombiner {
|
class DAGCombiner {
|
||||||
SelectionDAG &DAG;
|
SelectionDAG &DAG;
|
||||||
const TargetLowering &TLI;
|
const TargetLowering &TLI;
|
||||||
|
const SelectionDAGTargetInfo *STI;
|
||||||
CombineLevel Level;
|
CombineLevel Level;
|
||||||
CodeGenOpt::Level OptLevel;
|
CodeGenOpt::Level OptLevel;
|
||||||
bool LegalDAG = false;
|
bool LegalDAG = false;
|
||||||
bool LegalOperations = false;
|
bool LegalOperations = false;
|
||||||
bool LegalTypes = false;
|
bool LegalTypes = false;
|
||||||
bool ForCodeSize;
|
bool ForCodeSize;
|
||||||
|
bool DisableGenericCombines;
|
||||||
|
|
||||||
/// Worklist of all of the nodes that need to be simplified.
|
/// Worklist of all of the nodes that need to be simplified.
|
||||||
///
|
///
|
||||||
|
@ -223,9 +225,11 @@ namespace {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DAGCombiner(SelectionDAG &D, AliasAnalysis *AA, CodeGenOpt::Level OL)
|
DAGCombiner(SelectionDAG &D, AliasAnalysis *AA, CodeGenOpt::Level OL)
|
||||||
: DAG(D), TLI(D.getTargetLoweringInfo()), Level(BeforeLegalizeTypes),
|
: DAG(D), TLI(D.getTargetLoweringInfo()),
|
||||||
OptLevel(OL), AA(AA) {
|
STI(D.getSubtarget().getSelectionDAGInfo()),
|
||||||
|
Level(BeforeLegalizeTypes), OptLevel(OL), AA(AA) {
|
||||||
ForCodeSize = DAG.shouldOptForSize();
|
ForCodeSize = DAG.shouldOptForSize();
|
||||||
|
DisableGenericCombines = STI && STI->disableGenericCombines(OptLevel);
|
||||||
|
|
||||||
MaximumLegalStoreInBits = 0;
|
MaximumLegalStoreInBits = 0;
|
||||||
// We use the minimum store size here, since that's all we can guarantee
|
// We use the minimum store size here, since that's all we can guarantee
|
||||||
|
@ -1648,7 +1652,9 @@ SDValue DAGCombiner::visit(SDNode *N) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDValue DAGCombiner::combine(SDNode *N) {
|
SDValue DAGCombiner::combine(SDNode *N) {
|
||||||
SDValue RV = visit(N);
|
SDValue RV;
|
||||||
|
if (!DisableGenericCombines)
|
||||||
|
RV = visit(N);
|
||||||
|
|
||||||
// If nothing happened, try a target-specific DAG combine.
|
// If nothing happened, try a target-specific DAG combine.
|
||||||
if (!RV.getNode()) {
|
if (!RV.getNode()) {
|
||||||
|
@ -11790,7 +11796,6 @@ SDValue DAGCombiner::visitFADDForFMACombine(SDNode *N) {
|
||||||
if (!AllowFusionGlobally && !isContractable(N))
|
if (!AllowFusionGlobally && !isContractable(N))
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
const SelectionDAGTargetInfo *STI = DAG.getSubtarget().getSelectionDAGInfo();
|
|
||||||
if (STI && STI->generateFMAsInMachineCombiner(OptLevel))
|
if (STI && STI->generateFMAsInMachineCombiner(OptLevel))
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
|
@ -12008,7 +12013,6 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
|
||||||
if (!AllowFusionGlobally && !isContractable(N))
|
if (!AllowFusionGlobally && !isContractable(N))
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
const SelectionDAGTargetInfo *STI = DAG.getSubtarget().getSelectionDAGInfo();
|
|
||||||
if (STI && STI->generateFMAsInMachineCombiner(OptLevel))
|
if (STI && STI->generateFMAsInMachineCombiner(OptLevel))
|
||||||
return SDValue();
|
return SDValue();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue