redis refactoring

hide Redis in a KVStore class

perform static profiling properly 

N.B. static profile counts for non-optimizations are off by 5x for the opt pass, because the pass runs 5 times. I don't think we care since optimizations and non-optimizations will always be ranked separately. profiling of non-optimizations is a niche use case anyway.
The two new arguments could be combined into a `KVForStaticProfile` or something. That also makes it clearer what the purpose of passing a `KVStore` into this function is.