[SantizerCoverage] handle missing DBG MD when inserting libcalls
authorNick Desaulniers <ndesaulniers@google.com>
Mon, 12 Apr 2021 22:55:53 +0000 (15:55 -0700)
committerNick Desaulniers <ndesaulniers@google.com>
Mon, 12 Apr 2021 22:55:58 +0000 (15:55 -0700)
commit4914c9836765532ffaec9c85bc57690dbdaeb50f
tree82bc6d24c8c8653aaf246b2791e48e96e17ec97c
parent27dfcd978edc94b4b46218b12a3dfbcdc47ae4c8
[SantizerCoverage] handle missing DBG MD when inserting libcalls

Instruction::getDebugLoc can return an invalid DebugLoc. For such cases
where metadata was accidentally removed from the libcall insertion
point, simply insert a DILocation with line 0 scoped to the caller. When
we can inline the libcall, such as during LTO, then we won't fail a
Verifier check that all calls to functions with debug metadata
themselves must have debug metadata.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D100158
llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
llvm/test/Instrumentation/SanitizerCoverage/crit-edge-sancov.ll [new file with mode: 0644]