[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
Mon Aug 28 02:14:57 PDT 2023


This revision was automatically updated to reflect the committed changes.
ldrumm marked an inline comment as done.
Closed by commit rG471d9c57afb4: [NFC][AMDGPU] assert we've found a value before use (authored by ldrumm).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158845

Files:
  llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp


Index: llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -593,11 +593,10 @@
   for (; I != E; ++I) {
     std::vector<std::pair<SUnit *, SUnit *>> AddedEdges;
     int CandSGID = *I;
-    SchedGroup *Match;
-    for (auto &SG : SyncPipeline) {
-      if (SG.getSGID() == CandSGID)
-        Match = &SG;
-    }
+    SchedGroup *Match = llvm::find_if(SyncPipeline, [CandSGID](SchedGroup &SG) {
+      return SG.getSGID() == CandSGID;
+    });
+    assert(Match);
 
     if (UseCostHeur) {
       if (Match->isFull()) {
@@ -739,11 +738,10 @@
   for (; I != E; ++I) {
     std::vector<std::pair<SUnit *, SUnit *>> AddedEdges;
     int CandSGID = *I;
-    SchedGroup *Match;
-    for (auto &SG : SyncPipeline) {
-      if (SG.getSGID() == CandSGID)
-        Match = &SG;
-    }
+    SchedGroup *Match = llvm::find_if(SyncPipeline, [CandSGID](SchedGroup &SG) {
+      return SG.getSGID() == CandSGID;
+    });
+    assert(Match);
 
     LLVM_DEBUG(dbgs() << "Trying SGID # " << CandSGID << " with Mask "
                       << (int)Match->getMask() << "\n");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158845.553869.patch
Type: text/x-patch
Size: 1211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230828/ec2dee13/attachment.bin>


More information about the llvm-commits mailing list