[PATCH] D158845: [NFC][AMDGPU] assert we've found a value before use

Luke Drummond via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 25 07:15:35 PDT 2023


ldrumm planned changes to this revision.
ldrumm added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp:597
+    SchedGroup *Match = nullptr;
     for (auto &SG : SyncPipeline) {
       if (SG.getSGID() == CandSGID)
----------------
jrbyrnes wrote:
> Can we convert these into std::find_if?
> 
>     SchedGroup *Match = std::find_if(
>         SyncPipeline.begin(), SyncPipeline.end(),
>         [&CandSGID](SchedGroup SG) { return SG.getSGID() == CandSGID; });
>     assert(Match != SyncPipeline.end());
Yeah. That'd work too. We can also use `llvm::find_if`, and capture `CandSGID` by value.
Updated


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158845



More information about the llvm-commits mailing list