HomePhabricator

[X86][Disassembler] Simplify and optimize reader functions

Authored by MaskRay on Jan 10 2020, 11:43 PM.

Description

[X86][Disassembler] Simplify and optimize reader functions

llvm-objdump -d on clang is decreased from 8.2s to 7.8s.

Details

Committed
MaskRayJan 11 2020, 11:24 AM
Parents
rG9cc9120969fd: [X86] Turn FP_ROUND/STRICT_FP_ROUND into X86ISD::VFPROUND/STRICT_VFPROUND…
Branches
Unknown
Tags
Unknown

Event Timeline

This appears to have broken bounds checking in some cases.
There don't seem to be any in-tree tests, but the exegesis DisassemblerTest.TooShortABuffer hits an LLVM assertion:

F0113 07:35:07.768071 1340 logging.cc:92] assert.h assertion failed at third_party/llvm/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:250 in const T &llvm::ArrayRef<unsigned char>::operator[](size_t) const [T = unsigned char]: Index < Length && "Invalid index!"

  • Check failure stack trace: *** @ 0x7f9d160544a3 absl::logging_internal::LogMessage::DieIfFatal() @ 0x7f9d160533d6 absl::logging_internal::LogMessage::Flush() @ 0x7f9d16055f29 absl::logging_internal::LogMessageFatal::~LogMessageFatal() @ 0x7f9d16050106 __assert_fail @ 0x7f9d1b262dde llvm::X86Disassembler::decodeInstruction() @ 0x7f9d1b25f340 (anonymous namespace)::X86GenericDisassembler::getInstruction() @ 0x7f9d1b9fe7bb exegesis::Disassembler::DisassembleToMCInst() @ 0x7f9d1b9fea1d exegesis::Disassembler::Disassemble() @ 0x7f9d1ba171bf exegesis::(anonymous namespace)::DisassemblerTest_TooShortABuffer_Test::TestBody() @ 0x7f9d16865d0a testing::Test::Run() @ 0x7f9d16866e50 testing::TestInfo::Run() @ 0x7f9d16867827 testing::TestSuite::Run() @ 0x7f9d168765a7 testing::internal::UnitTestImpl::RunAllTests() @ 0x7f9d16875bb5 testing::UnitTest::Run() @ 0x561ff8529166 main

I'll try to fix this up.