-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[CodeGen] Allocate RegAllocHints map lazily #102186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This hint map is not required whenever a new register is added, in fact, at -O0, it is not used at all. Growing this map is quite expensive, as SmallVectors are not trivially copyable. Grow this map only when hints are actually added to avoid multiple grows and grows when no hints are added at all.
@@ -801,6 +801,7 @@ class MachineRegisterInfo { | |||
/// of an earlier hint it will be overwritten. | |||
void setRegAllocationHint(Register VReg, unsigned Type, Register PrefReg) { | |||
assert(VReg.isVirtual()); | |||
RegAllocHints.grow(Register::index2VirtReg(getNumVirtRegs())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be getNumVirtRegs() - 1
? grow
expects an index. getNumVRegs() is one past the largest index. Or maybe we could use resize
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, opened #102273
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/66/builds/2559 Here is the relevant piece of the build log for the reference:
|
This hint map is not required whenever a new register is added, in fact, at -O0, it is not used at all. Growing this map is quite expensive, as SmallVectors are not trivially copyable.
Grow this map only when hints are actually added to avoid multiple grows and grows when no hints are added at all.
c-t-t