[DWARF][FIX] Try not to crash for nvptx with missing debug information
authorJohannes Doerfert <johannes@jdoerfert.de>
Wed, 27 Oct 2021 22:00:41 +0000 (17:00 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 20 Jan 2022 00:40:13 +0000 (18:40 -0600)
commitdd75a6b2ae5c9c6628fb855473dc2f31073440d0
tree7642f25cad7b56156df26b924ac7032627a08e03
parentb4a7559844d06928234d576335316bf82d792c08
[DWARF][FIX] Try not to crash for nvptx with missing debug information

This prevents crashes in the OpenMP offload pipeline as not everything
is properly annotated with debug information, e.g., the runtimes we link
in. While we might want to have them annotated, it seems to be generally
useful to gracefully handle missing debug info rather than crashing.

TODO: A test is missing and can hopefully be distilled prior to landing.

This fixes #51079.

Differential Revision: https://reviews.llvm.org/D116959
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/DebugInfo/NVPTX/crash-missing-DISubprogram.ll [new file with mode: 0644]