[llvm-dev] large slowdown in DAGCombiner::MergeConsecutiveStores

Jeff Bezanson via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 19 13:29:38 PDT 2020

Hello all,

We are seeing a large compiler performance regression in moving from LLVM
6.0.1 to 8.0.1. We have a long function (~50000 instructions) that used to
compile in about a minute but now takes at least an hour. All the time is
in MergeConsecutiveStores, I believe due to super-linear behavior in
analyzing very long chains of stores. For example, this change makes the
problem go away:

--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -16011,6 +16011,9 @@ bool
DAGCombiner::MergeConsecutiveStores(StoreSDNode *St) {
                        StoreNodes.begin() + NumConsecutiveStores);
+    else if (NumConsecutiveStores > 128) {
+      return RV;
+    }

Does anybody have any advice on what a good way to fix this would be? Does
it make sense to have some kind of limit on how many stores we try to
merge? (Even if so, I don't know whether the above is the right way to
implement such a limit.)

Thanks in advance for any suggestions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200319/5f12abd4/attachment.html>

More information about the llvm-dev mailing list