[PATCH] D104010: [AMDGPU] Fix a crash when access beyond the end of the basic block

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 01:10:41 PDT 2021


foad added a comment.

Needs a test case.



================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:7736
   for (auto I = std::next(DefMI.getIterator()); ; ++I) {
-    assert(I != DefBB->end());
 
----------------
It's not OK to just remove this assert. After the first loop (line 7717) NumUses should be set to the number of uses of VReg in DefBB. The second loop should return false as soon as it has seen all the uses, so it should not fall off the end of the BB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104010



More information about the llvm-commits mailing list