[llvm] r306006 - [DAG] Add Target Store Merge pass ordering function
Nirav Dave via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 08:07:49 PDT 2017
Author: niravd
Date: Thu Jun 22 10:07:49 2017
New Revision: 306006
URL: http://llvm.org/viewvc/llvm-project?rev=306006&view=rev
Log:
[DAG] Add Target Store Merge pass ordering function
Allow targets to specify if they should merge stores before or after
legalization.
Modified:
llvm/trunk/include/llvm/Target/TargetLowering.h
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=306006&r1=306005&r2=306006&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
+++ llvm/trunk/include/llvm/Target/TargetLowering.h Thu Jun 22 10:07:49 2017
@@ -410,6 +410,10 @@ public:
return false;
}
+ /// Should we merge stores after Legalization (generally
+ /// better quality) or before (simpler)
+ virtual bool mergeStoresAfterLegalization() const { return false; }
+
/// Returns if it's reasonable to merge stores to MemVT size.
virtual bool canMergeStoresTo(unsigned AddressSpace, EVT MemVT) const {
return true;
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=306006&r1=306005&r2=306006&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Jun 22 10:07:49 2017
@@ -13209,7 +13209,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *
// Only perform this optimization before the types are legal, because we
// don't want to perform this optimization on every DAGCombine invocation.
- if (!LegalTypes) {
+ if ((TLI.mergeStoresAfterLegalization()) ? Level == AfterLegalizeDAG
+ : !LegalTypes) {
for (;;) {
// There can be multiple store sequences on the same chain.
// Keep trying to merge store sequences until we are unable to do so
More information about the llvm-commits
mailing list