-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
reduced size of ValueFlow::Value
#6784
base: main
Are you sure you want to change the base?
Conversation
lib/vfvalue.h
Outdated
|
||
/** kind of moved */ | ||
enum class MoveKind : std::uint8_t { NonMovedVariable, MovedVariable, ForwardedVariable } moveKind = MoveKind::NonMovedVariable; | ||
int indirect{}; // TODO: can we reduce the size? |
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.
@chrchr-github how high/low can this go? would a 8-bit value be enough for this?
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.
8bit unsigned should plenty, unless negative values are used somewhere?
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.
It looks like it can go negative based on the code so it should be signed.
lib/vfvalue.h
Outdated
@@ -280,27 +299,12 @@ namespace ValueFlow | |||
|
|||
ErrorPath errorPath; | |||
|
|||
ErrorPath debugPath; | |||
ErrorPath debugPath; // TODO: make lighter by default |
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.
This is only used when --debug
is specified. So we waste 16 bytes for having a full type instead of a pointer.
I did hack this out locally and it saves about 3% IR and several operations no longer show up at all in profiling it appears we just narrowly exceed some threshold for some compiler optimization(s) or allocation pattern.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Still need to clean up the macros. And I would like to get the TODOs addressed as well. The constant for the padding also needs to be adjusted so takes the default alignment into account and we do not overpad. I was also thinking about a macro. |
3721904
to
a31f183
Compare
lib/vfvalue.h
Outdated
|
||
int indirect{}; | ||
long long : 4; |
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.
What the reason for this?
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.
That is explicit padding.
a31f183
to
560e1da
Compare
This is mostly clean now and reduces the size from 168 bytes to 136 bytes. But the |
560e1da
to
bf3758b
Compare
No description provided.