[llvm] [MachineOutliner] Efficient Implementation of MachineOutliner::findCandidates() (PR #90260)
Xuan Zhang via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 11:17:00 PDT 2024
================
@@ -593,7 +593,11 @@ void MachineOutliner::findCandidates(
unsigned NumDiscarded = 0;
unsigned NumKept = 0;
#endif
- for (const unsigned &StartIdx : RS.StartIndices) {
+ // Sort the start indices so that we can efficiently check if candidates
+ // overlap with each other in MachineOutliner::findCandidates().
+ SmallVector<unsigned> SortedStartIndices(RS.StartIndices);
----------------
xuanzh-meta wrote:
It is because the iterator for the outer loop (`RS`) is of const type and thus we cannot be directly sort `RS.StartIndices`.
https://github.com/llvm/llvm-project/pull/90260
More information about the llvm-commits
mailing list