diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-09-18 20:54:26 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-09-18 20:54:26 +0000 |
commit | 7765c93be2f3c0c8938ca17e80cd91b9a0c6daf1 (patch) | |
tree | 96943fa6a79bc4f44fe60f929a8dbcb2e503cd4a /llvm/lib/CodeGen | |
parent | 39cdb84560177ceb583f07f8e29d3883639fa86c (diff) | |
download | bcm5719-llvm-7765c93be2f3c0c8938ca17e80cd91b9a0c6daf1.tar.gz bcm5719-llvm-7765c93be2f3c0c8938ca17e80cd91b9a0c6daf1.zip |
[DAG, x86] allow store merging before and after legalization (PR34217)
rL310710 allowed store merging to occur after legalization to catch stores that are created late,
but this exposes a logic hole seen in PR34217:
https://bugs.llvm.org/show_bug.cgi?id=34217
We will miss merging stores if the target lowers vector extracts into target-specific operations.
This patch allows store merging to occur both before and after legalization if the target chooses
to get maximum merging.
I don't think the potential regressions in the other tests are relevant. The tests are for
correctness of weird IR constructs rather than perf tests, and I think those are still correct.
Differential Revision: https://reviews.llvm.org/D37987
llvm-svn: 313564
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index f81a144de82..b69a5f4738c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -13565,10 +13565,10 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) { Ptr, ST->getMemoryVT(), ST->getMemOperand()); } - // Only perform this optimization before the types are legal, because we - // don't want to perform this optimization on every DAGCombine invocation. - if ((TLI.mergeStoresAfterLegalization()) ? Level == AfterLegalizeDAG - : !LegalTypes) { + // Always perform this optimization before types are legal. If the target + // prefers, also try this after legalization to catch stores that were created + // by intrinsics or other nodes. + if (!LegalTypes || (TLI.mergeStoresAfterLegalization())) { for (;;) { // There can be multiple store sequences on the same chain. // Keep trying to merge store sequences until we are unable to do so |