Improve BitVecOps<>::Iter::NextElem (#11696)
authorBruce Forstall <brucefo@microsoft.com>
Fri, 19 May 2017 20:58:35 +0000 (13:58 -0700)
committerGitHub <noreply@github.com>
Fri, 19 May 2017 20:58:35 +0000 (13:58 -0700)
commit698a89e6e2d6866666dd942bdf7506f96fb8310e
tree60e7a4d7b8942793d7772281a6dfbf891a49be42
parent6ce65bd1bc1570e4e37b6f6c7c5acb640e6dcac5
Improve BitVecOps<>::Iter::NextElem (#11696)

* Improve BitVecOps<>::Iter::NextElem

Tweak the implementation, to reduce the number of instructions
executed in the hot path.

Also, don't pass "env" to NextElem; it can be stored by Init()
if required. For non-inlined calls, this saves setting up one
argument.

Use a `m_bsEnd` end condition. This eliminates the need to handle
short/long differently, and reduces conditions when updating
the current bits to iterate over in the long case.

Overall, pin shows this reduces instruction count of superpmi over
a minopts test run by 2.6% (NextElem is very hot).

Also, fix BitSetAsUInt64 NextElem() iterator: It should store and updated
its own bit count, and not depend on the value passed in to be the
correct latest bit count.
17 files changed:
src/jit/assertionprop.cpp
src/jit/bitset.cpp
src/jit/bitset.h
src/jit/bitsetasshortlong.h
src/jit/bitsetasuint64.h
src/jit/bitsetasuint64inclass.h
src/jit/codegencommon.cpp
src/jit/codegenlegacy.cpp
src/jit/codegenlinear.cpp
src/jit/compiler.cpp
src/jit/flowgraph.cpp
src/jit/liveness.cpp
src/jit/lsra.cpp
src/jit/rangecheck.cpp
src/jit/regalloc.cpp
src/jit/scopeinfo.cpp
src/jit/ssabuilder.cpp