improve static local variable correlation

Improve the static local variable correlation logic, for the case where
a static local is used by multiple functions.  For each usage of the
variable, look for a corresponding usage in the base object.  If we find
at least one matching usage, consider it a twin.
Ok... so it looks like these next 8 or so lines are the functional change here; everything else is refactoring?  It's hard to separate the functional change from refactoring in this diff.