[llvm] 471d9c5 - [NFC][AMDGPU] assert we've found a value before use
Luke Drummond via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 28 02:14:53 PDT 2023
Author: Luke Drummond
Date: 2023-08-28T10:14:47+01:00
New Revision: 471d9c57afb4dda9b4663e08b1c0be5120331cc0
URL: https://github.com/llvm/llvm-project/commit/471d9c57afb4dda9b4663e08b1c0be5120331cc0
DIFF: https://github.com/llvm/llvm-project/commit/471d9c57afb4dda9b4663e08b1c0be5120331cc0.diff
LOG: [NFC][AMDGPU] assert we've found a value before use
The sync pipeline should always contain the candidate ID. If it doesn't
something's gone awry. assert on that.
Reviewed by: jrbyrnes
Differential Revision: https://reviews.llvm.org/D158845
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index ffa6c88f9d4114..6a0e44b9c98a9b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -593,11 +593,10 @@ void PipelineSolver::populateReadyList(
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 @@ void PipelineSolver::greedyFind(
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");
More information about the llvm-commits
mailing list