[llvm] [llvm-exegesis] Make duplicate snippet repetitor produce whole snippets (PR #77224)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 06:10:23 PST 2024


================
@@ -31,7 +31,11 @@ class DuplicateSnippetRepetitor : public SnippetRepetitor {
       if (!Instructions.empty()) {
         // Add the whole snippet at least once.
         Entry.addInstructions(Instructions);
-        for (unsigned I = Instructions.size(); I < MinInstructions; ++I) {
+        unsigned FullInstructionCount = MinInstructions;
+        if (FullInstructionCount % Instructions.size() != 0)
+          FullInstructionCount +=
+              Instructions.size() - (MinInstructions % Instructions.size());
----------------
legrosbuffle wrote:

We can probably write this in a simpler way:

```
const int NumRepetitions = divideCeil(MinInstructions, Instructions.size())`;
for (unsigned I = 0; I < NumRepetitions; ++I) {
  Entry.addInstructions(Instructions);
}
```

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


More information about the llvm-commits mailing list