[llvm-branch-commits] [libc] [openmp] [clang-tools-extra] [libcxx] [lldb] [flang] [clang] [mlir] [llvm] [BOLT] Deduplicate equal offsets in BAT (PR #76905)
Davide Italiano via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 18 13:24:56 PST 2024
================
@@ -207,15 +280,23 @@ void BoltAddressTranslation::parseMaps(std::vector<uint64_t> &HotFuncs,
const uint64_t OutputAddress = PrevAddress + OutputDelta;
const uint64_t OutputOffset = OutputAddress - Address;
PrevAddress = OutputAddress;
- const int64_t InputDelta = DE.getSLEB128(&Offset, &Err);
- InputOffset += InputDelta;
+ int64_t InputDelta = 0;
+ if (J < EqualElems) {
+ InputOffset = (OutputOffset << 1) | (*BEBitMask)[J];
+ } else {
+ InputDelta = DE.getSLEB128(&Offset, &Err);
+ InputOffset += InputDelta;
+ }
Map.insert(std::pair<uint32_t, uint32_t>(OutputOffset, InputOffset));
LLVM_DEBUG(
dbgs() << formatv("{0:x} -> {1:x} ({2}/{3}b -> {4}/{5}b), {6:x}\n",
OutputOffset, InputOffset, OutputDelta,
- encodeULEB128(OutputDelta, nulls()), InputDelta,
- encodeSLEB128(InputDelta, nulls()), OutputAddress));
+ getULEB128Size(OutputDelta), InputDelta,
+ (J < EqualElems) ? 0 : getSLEB128Size(InputDelta),
+ OutputAddress));
}
+ if (BEBitMask)
+ delete BEBitMask;
----------------
dcci wrote:
Can you make this automatically memory managed?
https://github.com/llvm/llvm-project/pull/76905
More information about the llvm-branch-commits
mailing list