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

qishilu3 via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 9 23:25:10 PDT 2021


qishilu created this revision.
qishilu added a reviewer: vpykhtin.
Herald added subscribers: foad, kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
qishilu requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

the phi instruction is at front of the basic 。
and the loop will out of bound if the use instruction is a phi instruction

the crash log at 50617 <https://bugs.llvm.org/show_bug.cgi?id=50617>
(I don't have commit access)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104010

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


Index: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -7733,7 +7733,8 @@
 
   // Stop scan when we have seen all the uses.
   for (auto I = std::next(DefMI.getIterator()); ; ++I) {
-    assert(I != DefBB->end());
+    if(I == DefBB->end())
+      return true;
 
     if (I->isDebugInstr())
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104010.351073.patch
Type: text/x-patch
Size: 456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210610/4ca29148/attachment.bin>


More information about the llvm-commits mailing list