[PATCH] D110534: [llvm-reduce] Reduce metadata references.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 13:23:59 PDT 2021


Meinersbur added inline comments.


================
Comment at: llvm/tools/llvm-reduce/deltas/ReduceMetadata.cpp:61
+      for (std::pair<unsigned, MDNode *> &MD : MDs)
+        if (!O.shouldKeep())
+          I.setMetadata(MD.first, NULL);
----------------
aeubanks wrote:
> nickdesaulniers wrote:
> > I was curious if we should switch the order of the for/if on `!O.shouldKeep()`, but if I'm reading this correctly, it seems that if `O.shouldKeep() == true`, then we do no work in this function and should just return early? Then we can remove all of the conditional checks on `!O.shouldKeep()`?
> `O.shouldKeep()` is not constant, the whole point of llvm-reduce is that it returns true/false for different calls so we can try reducing various subsets of whatever we're trying to reduce since we may not be able to remove everything all at once, or even one at a time, things may need to be reduced in batches.
To add to @aeubanks explanation, `Oracle::shouldKeep()` is comparable to Google Benchmark's `State::KeepRunning()` or LLVM's `OptBisect::shouldRunPass()`. It controls loop behaviour depending on when/how often it has been called already without explicitly passing which loop iteration we are in.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110534/new/

https://reviews.llvm.org/D110534



More information about the llvm-commits mailing list