This patch includes a couple of small changes needed for a follow on patch. One them fixes a latent bug (which I believe is unreachable today).
Changes are:
- Ensure that calling getValueInBlock with a constant works. It's trivial, but there's nothing preventing this getting called in the outer layers. Additionally, we've been apparently re-querying the outermost block on each access. This is a waste of compile time and (hopefully) will produce the same result as using the previously cached result.
- Use the full power of the getValueInBlock interface for getValueAt when the query instruction is at the end of a block. I don't know of a test case which clearly illustrates this difference, but in principal, we may be able to remove a few extra comparisons after this change. The main reason for this is to better test existing code paths.
- Fix a bug exposed by (2) where we weren't actually using the range metadata results within the getValueInBlock solving.
I think the same logic can be better stated by having Res be a Optional<LVILatticeVal> instead of LVILatticeVal. Using the undefined state this way is confusing as I'd normally assume a value to be undefined to mean that the code that uses it is dead.