This is an archive of the discontinued LLVM Phabricator instance.

[AtomicExpand] Avoid creating an unnamed libcall
ClosedPublic

Authored by arichardson on Oct 4 2020, 12:18 PM.

Details

Summary

I recently modified this pass to better support CHERI-RISC-V and while
doing so I noticed that this pass was calling M->getOrInsertFunction()
with the result of TLI->getLibcallName(RTLibType). However, AMDGPU fills
the libcalls array with nullptr, so this creates an anonymous function
instead. This patch changes expandAtomicOpToLibcall to return false in
case the libcall does not exist and changes the assert() in the callees to
a report_fatal_error instead.

Diff Detail

Event Timeline

arichardson created this revision.Oct 4 2020, 12:18 PM
arichardson requested review of this revision.Oct 4 2020, 12:18 PM
arsenm accepted this revision.Nov 2 2020, 9:17 AM

Arguably this could be a proper context error but this is an improvement

This revision is now accepted and ready to land.Nov 2 2020, 9:17 AM
This revision was automatically updated to reflect the committed changes.