Skip to content
Snippets Groups Projects
Commit f1842937 authored by Jeremy Morse's avatar Jeremy Morse Committed by Jeremy Morse
Browse files

[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.
parent a80d5c34
No related branches found
No related tags found
No related merge requests found
...@@ -132,6 +132,11 @@ public: ...@@ -132,6 +132,11 @@ public:
u.s = {Block, Inst, Loc.asU64()}; 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 getBlock() const { return u.s.BlockNo; }
uint64_t getInst() const { return u.s.InstNo; } uint64_t getInst() const { return u.s.InstNo; }
uint64_t getLoc() const { return u.s.LocNo; } uint64_t getLoc() const { return u.s.LocNo; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment