fix bug for get_valid_iv_sym

When sub-string is used in the following way, it does not work well.

o = Object.new
o.instance_variable_set(:@a, 1)
o.instance_variable_defined?("@abc"[0,2]) #=> false (this should be true)
Merge pull request #1748 from cubicdaiya/issues/optim_get_valid_iv_sym

fix bug for get_valid_iv_sym