This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Avoid overwriting saved PC
ClosedPublic

Authored by kerbowa on Oct 27 2019, 1:29 AM.

Details

Summary

An outstanding load with same destination sgpr as call could cause PC to be
updated with junk value on return.

Diff Detail

Event Timeline

kerbowa created this revision.Oct 27 2019, 1:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2019, 1:29 AM
arsenm added inline comments.Oct 27 2019, 10:04 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
957

This is a potentially confusing name. It's the return address operand

959

This should never fail

kerbowa added inline comments.Oct 27 2019, 10:24 AM
llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp
959

It fails with SI_TCRETURN/S_SETPC.

kerbowa updated this revision to Diff 226579.Oct 27 2019, 11:17 AM

Address comments, rename variable.

arsenm accepted this revision.Oct 28 2019, 9:23 AM

LGTM with test comment

llvm/test/CodeGen/AMDGPU/call-waw-waitcnt.mir
4

Could use a short description here of what this is testing, and point out the specific register names

This revision is now accepted and ready to land.Oct 28 2019, 9:23 AM
This revision was automatically updated to reflect the committed changes.