llvm-objdump: speed up -objc-meta-data
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 8 Jan 2017 19:14:15 +0000 (19:14 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 8 Jan 2017 19:14:15 +0000 (19:14 +0000)
commit8204fd73206682998c8d78f7e4c0e351f1b79ca4
tree4e760caa1bbb7fece995a4ab6f39039802b7ce84
parent6c125750686b08c05263a26e1963ace88be6b690
llvm-objdump: speed up -objc-meta-data

Running a Debug build of objdump -objc-meta-data with a large Mach-O file is
currently unnecessarily slow.

With some local test input, this change reduces the run time from 75-85s down
to 15-20s.

The two changes are:
  Assert on pointer equality not array equality
  Replace vector<pair<address, symbol>> with DenseMap<address, symbol>

Additionally, use a std::unique_ptr rather than handling the memory manually.

Patch by Dave Lee!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291398 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Object/MachOObjectFile.cpp
tools/llvm-objdump/MachODump.cpp