Change compiler optimizations to -O3 -flto (#11207)

Optimization update from -O2 to -O3 -flto gives up to 5% performance gain
in 'redis-benchmarks-spec-client-runner' tests geomean where GCC 9.4.0 is used for build

* Fix for false-positive warning in bitops.c
   Warning appeared with O3, on CentOS during inlininig procedure
* Fixed unitialized streamID within streamTrim() (#1)

Co-authored-by: filipe oliveira <filipecosta.90@gmail.com>
This commit is contained in:
Maria Markova 2022-10-02 14:15:14 +02:00 committed by GitHub
parent 3c02d1acc4
commit 3469c6509c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -15,7 +15,7 @@
release_hdr := $(shell sh -c './mkreleasehdr.sh')
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not')
OPTIMIZATION?=-O2
OPTIMIZATION?=-O3 -flto
DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram
NODEPS:=clean distclean

View File

@ -1180,7 +1180,9 @@ void bitfieldGeneric(client *c, int flags) {
addReplyNull(c);
}
} else {
uint64_t oldval, newval, wrapped, retval;
/* Initialization of 'wrapped' is required to avoid
* false-positive warning "-Wmaybe-uninitialized" */
uint64_t oldval, newval, retval, wrapped = 0;
int overflow;
oldval = getUnsignedBitfield(o->ptr,thisop->offset,

View File

@ -747,7 +747,7 @@ int64_t streamTrim(stream *s, streamAddTrimArgs *args) {
streamDecodeID(ri.key, &master_id);
/* Read last ID. */
streamID last_id;
streamID last_id = {0,0};
lpGetEdgeStreamID(lp, 0, &master_id, &last_id);
/* We can remove the entire node id its last ID < 'id' */