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