This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Avoid a crash when 'llc' is called with '-filetype=null'
ClosedPublic

Authored by ikudrin on Mar 18 2022, 5:25 AM.

Details

Summary

For -filetype=null, NVPTXTargetStreamer is not created, so the return value of OutStreamer->getTargetStreamer() should be checked before calling the methods.

This fixes a crash in llvm/test/tools/llc/binutils-version.ll when LLVM is built with nvptx64-nvidia-cuda as a default target.

Diff Detail

Event Timeline

ikudrin created this revision.Mar 18 2022, 5:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2022, 5:25 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
ikudrin requested review of this revision.Mar 18 2022, 5:25 AM
tra accepted this revision.Mar 18 2022, 11:19 AM
This revision is now accepted and ready to land.Mar 18 2022, 11:19 AM
MaskRay accepted this revision.Mar 21 2022, 8:48 PM

Add a regression test in llvm/test/CodeGen/NVPTX like test/tools/llc/filetype-null-stop-after.ll ?