We have added a new load/store cluster algorithm in D85517. However, AArch64 see some compiling deg with the new algorithm as the IsReachable() is not cheap if the DAG is complex. O(M+N) See https://bugs.llvm.org/show_bug.cgi?id=47966
So, this patch added a heuristic to switch to old cluster algorithm if the DAG is too complex. For now, I used the heuristic value 5M for NumOfStores * NumOfSUnits. This is a rough threshold as I don't see compiling time impact with it. Welcome for more comments.
The case in https://bugs.llvm.org/show_bug.cgi?id=47966 is that, we have ~10000 LdSt and ~15000 SUnits in one region, which blow up the compiling time.