[llvm] [MachineOutliner] Efficient Implementation of MachineOutliner::findCandidates() (PR #90260)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Fri May 3 07:12:28 PDT 2024


================
@@ -616,17 +620,15 @@ void MachineOutliner::findCandidates(
       // * End before the other starts
       // * Start after the other ends
       unsigned EndIdx = StartIdx + StringLen - 1;
-      auto FirstOverlap = find_if(
-          CandidatesForRepeatedSeq, [StartIdx, EndIdx](const Candidate &C) {
-            return EndIdx >= C.getStartIdx() && StartIdx <= C.getEndIdx();
-          });
-      if (FirstOverlap != CandidatesForRepeatedSeq.end()) {
+      if (CandidatesForRepeatedSeq.size() > 0 &&
----------------
kyulee-com wrote:

Nit. you could do:
```
      if (!CandidatesForRepeatedSeq.empt() &&
```

https://github.com/llvm/llvm-project/pull/90260


More information about the llvm-commits mailing list