This is an archive of the discontinued LLVM Phabricator instance.

[NFC][AMDGPU] assert we've found a value before use
ClosedPublic

Authored by ldrumm on Aug 25 2023, 6:39 AM.

Details

Summary

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

Diff Detail

Event Timeline

ldrumm created this revision.Aug 25 2023, 6:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 6:39 AM
ldrumm requested review of this revision.Aug 25 2023, 6:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 6:39 AM
Herald added a subscriber: wdng. · View Herald Transcript
jrbyrnes added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
595–596

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());
ldrumm updated this revision to Diff 553462.Aug 25 2023, 7:15 AM

Use find_if instead of a search loop.

ldrumm planned changes to this revision.Aug 25 2023, 7:15 AM
ldrumm added inline comments.
llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
595–596

Yeah. That'd work too. We can also use llvm::find_if, and capture CandSGID by value.
Updated

ldrumm requested review of this revision.Aug 25 2023, 7:16 AM
jrbyrnes accepted this revision.Aug 25 2023, 8:01 AM

Thanks, LGTM

This revision is now accepted and ready to land.Aug 25 2023, 8:01 AM
This revision was automatically updated to reflect the committed changes.
ldrumm marked an inline comment as done.