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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 27 11:35:37 PDT 2021


aeubanks 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);
----------------
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.


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