There aren´t really global variables. I think you can use them, but it doesn´t make much difference to declaring them locally, I think. Shaders are fast and they are that fast because they are specifically written to be processed in parallel, which for example means that your code can´t depend on results of the execution of the shader for other vertices/pixels. As soon as you do the if check, you´ve got your dependency. Just think of it as reading the same variable at the same time and even worse, the moment you try to set it, they are all setting the same variable to another value at the same time, which just can´t really work.
The pixel shader will start after all vertices of the object you are rendering with are transformed. As the vertices could be moved to any location within the vertex shader, I don´t see a way for your graphicscard or driver to leave out some of the vertices.