-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add optimization option --fcombine-load-threshold=XXX
#77
Conversation
Define the rule: --X is for developers option.
src/optimization/LiteralValues.cpp
Outdated
@@ -791,7 +791,6 @@ InstructionWalker optimizations::handleUseWithImmediate( | |||
// and with constant/unsigned, etc.) | |||
if(localIt->getSingleWriter() != nullptr) | |||
it->addDecorations(intermediate::forwardDecorations(localIt->getSingleWriter()->decoration)); | |||
it.nextInBlock(); | |||
op->replaceLocal(oldLocal, tmp.local, LocalUse::Type::READER); |
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.
Why did you remove this instruction here? Was it a bug?
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 a bug. Fixed.
src/main.cpp
Outdated
if(buffer == name) | ||
{ | ||
std::getline(ss, buffer, '='); | ||
if(name == buffer) |
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.
Why do you re-test for the name?
I think it would be more obvious what is tested here if you reset buffer to an empty string and here test for the buffer still being empty.
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.
If input
is --fcombine-load-threshold
(just this, not including '='), ss
reach the end. Then second std::getline
do nothing. To detect it, name == buffer
is needed here.
I add comments about this.
Related #67.
This pullreq add
--fcombine-load-threshold
to adjust the threshold ofCombineLoadingLiterals
.The impact of the optimization is huge (which is discussed in #67), users may specify the threshold.
It's better to control it by the compiler, but now there is no good way.
The naming rule is as follows: