зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1850569 - Make it easier for the compiler to analyze mozilla::PrintfTarget::fill_n r=emilio
By coupling the state of `signwidth` and `sign`, we provide enough information to the compiler for it to get rid of an extra mov as a result of `-ftrivial-auto-var-init`. Differential Revision: https://phabricator.services.mozilla.com/D187047
This commit is contained in:
Родитель
289cf1ae78
Коммит
87f3a025e7
|
@ -108,25 +108,21 @@ bool mozilla::PrintfTarget::fill_n(const char* src, int srclen, int width,
|
|||
int prec, int type, int flags) {
|
||||
int zerowidth = 0;
|
||||
int precwidth = 0;
|
||||
int signwidth = 0;
|
||||
int leftspaces = 0;
|
||||
int rightspaces = 0;
|
||||
int cvtwidth;
|
||||
char sign;
|
||||
char sign = 0;
|
||||
|
||||
if ((type & 1) == 0) {
|
||||
if (flags & FLAG_NEG) {
|
||||
sign = '-';
|
||||
signwidth = 1;
|
||||
} else if (flags & FLAG_SIGNED) {
|
||||
sign = '+';
|
||||
signwidth = 1;
|
||||
} else if (flags & FLAG_SPACED) {
|
||||
sign = ' ';
|
||||
signwidth = 1;
|
||||
}
|
||||
}
|
||||
cvtwidth = signwidth + srclen;
|
||||
cvtwidth = (sign ? 1 : 0) + srclen;
|
||||
|
||||
if (prec > 0 && (type != TYPE_DOUBLE)) {
|
||||
if (prec > srclen) {
|
||||
|
@ -158,7 +154,7 @@ bool mozilla::PrintfTarget::fill_n(const char* src, int srclen, int width,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if (signwidth) {
|
||||
if (sign) {
|
||||
if (!emit(&sign, 1)) {
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче