[DAG] Add Target Store Merge pass ordering function

Allow targets to specify if they should merge stores before or after
legalization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nirav Dave 2017-06-22 15:07:49 +00:00
parent 2dfb7e4fe8
commit 9bd0f56ab3
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -13209,7 +13209,8 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
// 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