This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix a crash when access beyond the end of the basic block
Needs ReviewPublic

Authored by qishilu on Jun 9 2021, 11:25 PM.

Details

Reviewers
vpykhtin
Summary

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

the crash log at 50617
(I don't have commit access)

Diff Detail

Event Timeline

qishilu created this revision.Jun 9 2021, 11:25 PM
qishilu requested review of this revision.Jun 9 2021, 11:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2021, 11:25 PM
qishilu edited the summary of this revision. (Show Details)Jun 9 2021, 11:27 PM
foad added a comment.Jun 10 2021, 1:10 AM

Needs a test case.

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
7736

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.