[BOLT] Use opcode name in hashBlock
authorAmir Ayupov <aaupov@fb.com>
Tue, 9 May 2023 01:53:48 +0000 (18:53 -0700)
committerAmir Ayupov <aaupov@fb.com>
Tue, 9 May 2023 01:54:29 +0000 (18:54 -0700)
commit6fcb91b2f756857f1295a28990738b5b6f924226
tree648f167a07d7cfd897aafa22e7a1d526d7c179ef
parent19941b0468c746a8d7ea543600fb491fe9808b04
[BOLT] Use opcode name in hashBlock

Use MCInst opcode name instead of opcode value in hashing.

Opcode values are unstable wrt changes to target tablegen definitions,
and we notice that as output mismatches in NFC testing. This makes BOLT YAML
profile tied to a particular LLVM revision which is less portable than
offset-based fdata profile.

Switch to using opcode names which have 1:1 mapping with opcode values for any
given LLVM revision, and are stable wrt modifications to .td files (except of
course modifications to names themselves).

Test Plan:
D150154 is a test commit adding new X86 instruction which shifts opcode values.
With current change, pre-aggregated-perf.test passes in nfc check mode.
Without current change, pre-aggregated-perf.test expectedly fails.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D150005
bolt/lib/Core/HashUtilities.cpp