[BOLT] Do no report error on mismatched instruction encoding

Summary:
When the validation of instruction encoding fails but we are able to
continue processing the binary, do no report an error. Report encoding
format only under `-v=1`.

(cherry picked from FBD19376531)
This commit is contained in:
Maksim Panchenko 2020-01-13 11:24:10 -08:00
parent 45b27d7b44
commit 0283271f29
1 changed files with 5 additions and 3 deletions

View File

@ -1851,9 +1851,11 @@ bool BinaryContext::validateEncoding(const MCInst &Inst,
MCE->encodeInstruction(Inst, VecOS, Fixups, *STI);
auto EncodedData = ArrayRef<uint8_t>((uint8_t *)Code.data(), Code.size());
if (InputEncoding != EncodedData) {
errs() << "BOLT-ERROR: mismatched encoding detected\n"
<< " input: " << InputEncoding << '\n'
<< " output: " << EncodedData << '\n';
if (opts::Verbosity > 1) {
errs() << "BOLT-WARNING: mismatched encoding detected\n"
<< " input: " << InputEncoding << '\n'
<< " output: " << EncodedData << '\n';
}
return false;
}