LTO: Verify the input even if optimize() isn't called
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Apr 2016 17:48:22 +0000 (17:48 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Apr 2016 17:48:22 +0000 (17:48 +0000)
commitb011ad7330e5cc82955862d3c7a0a47aaab9b8ab
treecf9ec9cbb1f5e55e0d3bddf7ff42f0fb0297523c
parentd826bbbb0a803952b13da40ac5f2a53bd15d6f28
LTO: Verify the input even if optimize() isn't called

Clients may call writeMergedModules before calling optimize, or call
compileOptimized without calling optimize.  Make sure they don't sneak
past the verifier.  This adds LTOCodeGenerator::verifyMergedModuleOnce,
and calls it from writeMergedModule, optimize, and codegenOptimized.

I couldn't find a good way to test this.  I tried writing broken IR to
send into llvm-lto, but LTOCodeGenerator doesn't understand textual IR,
and assembler runs the verifier itself anyway.  Checking in
valid-but-doesn't-verify bitcode here doesn't seem valuable.

llvm-svn: 266894
llvm/include/llvm/LTO/LTOCodeGenerator.h
llvm/lib/LTO/LTOCodeGenerator.cpp