Mangling is mostly used to distinguish linker symbols that would otherwise reasonably clash.
Since x
is implicitly static, multiple translation units can legally have different variables all called x
, so the symbol is mangled to avoid collisions.
Since y
is not static, there can be only one global variable called y
in the program, so there's no need to avoid collisions (they should either be flagged as ODR violations or de-duplicated by the linker).
The other use is for functions, to distinguish overloads with the same name but different argument lists. That clearly doesn't apply here.