Extract the load/store type verification to a separate function.