Move the stripping of invalid debug info from the Verifier to AutoUpgrade.
authorAdrian Prantl <aprantl@apple.com>
Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)
committerAdrian Prantl <aprantl@apple.com>
Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)
commita8b2ddbde453fab0db90be21b9a1ff961a7770e0
tree190712a839a2ce48d61e75501d2f68440891a2d8
parent6e17c00a88e23d0cc4cb491bfd0830f3df7fff66
Move the stripping of invalid debug info from the Verifier to AutoUpgrade.

This came out of a recent discussion on llvm-dev
(https://reviews.llvm.org/D38042). Currently the Verifier will strip
the debug info metadata from a module if it finds the dbeug info to be
malformed. This feature is very valuable since it allows us to improve
the Verifier by making it stricter without breaking bcompatibility,
but arguable the Verifier pass should not be modifying the IR. This
patch moves the stripping of broken debug info into AutoUpgrade
(UpgradeDebugInfo to be precise), which is a much better location for
this since the stripping of malformed (i.e., produced by older, buggy
versions of Clang) is a (harsh) form of AutoUpgrade.

This change is mostly NFC in nature, the one big difference is the
behavior when LLVM module passes are introducing malformed debug
info. Prior to this patch, a NoAsserts build would have printed a
warning and stripped the debug info, after this patch the Verifier
will report a fatal error. I believe this behavior is actually more
desirable anyway.

Differential Revision: https://reviews.llvm.org/D38184

llvm-svn: 314699
46 files changed:
llvm/include/llvm/AsmParser/Parser.h
llvm/include/llvm/IRReader/IRReader.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/AsmParser/LLParser.h
llvm/lib/AsmParser/Parser.cpp
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/IRReader/IRReader.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/test/Analysis/GlobalsModRef/pr12351.ll
llvm/test/DebugInfo/Generic/invalid.ll
llvm/test/DebugInfo/Generic/location-verifier.ll
llvm/test/DebugInfo/Generic/piece-verifier.ll
llvm/test/DebugInfo/pr34186.ll
llvm/test/DebugInfo/pr34672.ll
llvm/test/LTO/X86/strip-debug-info-no-call-loc.ll
llvm/test/LTO/X86/strip-debug-info.ll
llvm/test/Verifier/DILocation-parents.ll
llvm/test/Verifier/DISubprogram.ll
llvm/test/Verifier/callsite-dbgloc.ll
llvm/test/Verifier/dbg-difile-crash.ll
llvm/test/Verifier/dbg-invalid-compileunit.ll
llvm/test/Verifier/dbg-invalid-named-metadata.ll
llvm/test/Verifier/dbg-invalid-retaintypes.ll
llvm/test/Verifier/dbg-line-without-file.ll
llvm/test/Verifier/dbg-null-retained-type.ll
llvm/test/Verifier/dbg.ll
llvm/test/Verifier/diglobalvariable.ll
llvm/test/Verifier/fnarg-debuginfo.ll
llvm/test/Verifier/fragment.ll
llvm/test/Verifier/func-dbg.ll
llvm/test/Verifier/llvm.dbg.declare-address.ll
llvm/test/Verifier/llvm.dbg.declare-expression.ll
llvm/test/Verifier/llvm.dbg.declare-variable.ll
llvm/test/Verifier/llvm.dbg.value-expression.ll
llvm/test/Verifier/llvm.dbg.value-value.ll
llvm/test/Verifier/llvm.dbg.value-variable.ll
llvm/test/Verifier/metadata-function-dbg.ll
llvm/test/Verifier/pr34325.ll
llvm/test/Verifier/tbaa.ll
llvm/tools/llvm-as/llvm-as.cpp
llvm/tools/opt/opt.cpp
llvm/unittests/IR/VerifierTest.cpp