[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 06:39:29 PDT 2023


ldrumm created this revision.
ldrumm added a reviewer: arsenm.
Herald added subscribers: foad, kerbowa, hiraditya, tpr, dstuttard, yaxunl, jvesely, kzhuravl.
Herald added a project: All.
ldrumm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

The sync pipeline should always contain the candidate ID. If it doesn't something's gone awry. assert on that.


Repository:
  rG LLVM Github Monorepo

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,12 @@
   for (; I != E; ++I) {
     std::vector<std::pair<SUnit *, SUnit *>> AddedEdges;
     int CandSGID = *I;
-    SchedGroup *Match;
+    SchedGroup *Match = nullptr;
     for (auto &SG : SyncPipeline) {
       if (SG.getSGID() == CandSGID)
         Match = &SG;
     }
+    assert(Match);
 
     if (UseCostHeur) {
       if (Match->isFull()) {
@@ -739,11 +740,12 @@
   for (; I != E; ++I) {
     std::vector<std::pair<SUnit *, SUnit *>> AddedEdges;
     int CandSGID = *I;
-    SchedGroup *Match;
+    SchedGroup *Match = nullptr;
     for (auto &SG : SyncPipeline) {
       if (SG.getSGID() == CandSGID)
         Match = &SG;
     }
+    assert(Match);
 
     LLVM_DEBUG(dbgs() << "Trying SGID # " << CandSGID << " with Mask "
                       << (int)Match->getMask() << "\n");


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


More information about the llvm-commits mailing list