[llvm] f184293 - [DebugInfo][InstrRef][NFC] Add a missing assignment operator
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 31 08:09:28 PST 2022
Author: Jeremy Morse
Date: 2022-01-31T16:08:38Z
New Revision: f18429372f12b571aef539855c4dbef23a96f494
URL: https://github.com/llvm/llvm-project/commit/f18429372f12b571aef539855c4dbef23a96f494
DIFF: https://github.com/llvm/llvm-project/commit/f18429372f12b571aef539855c4dbef23a96f494.diff
LOG: [DebugInfo][InstrRef][NFC] Add a missing assignment operator
ValueIDNum is supposed to be a value type that boils down to a uint64_t,
that has some bitfields for convenience. If we use the default operator=,
we end up with each bit field being individually assigned, which is
un-necessarily slow.
Implement the assignment operator by just copying the uint64_t value of
the object. This is quicker, and matches how the comparison operators
work already. Doing so is 0.1% faster on the compile-time-tracker.
Added:
Modified:
llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index ed0c55a4cb1eb..6c0d14e1470ce 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -132,6 +132,11 @@ class ValueIDNum {
u.s = {Block, Inst, Loc.asU64()};
}
+ ValueIDNum &operator=(const ValueIDNum &Other) {
+ u.Value = Other.u.Value;
+ return *this;
+ }
+
uint64_t getBlock() const { return u.s.BlockNo; }
uint64_t getInst() const { return u.s.InstNo; }
uint64_t getLoc() const { return u.s.LocNo; }
More information about the llvm-commits
mailing list