The internalization pass only internalizes global variables
with no users. If the global variable has some dead user,
the internalization pass will not internalize it.
To be able to internalize global variables with dead
users, a global dce pass is needed before the
internalization pass.
This patch adds that.
Mixing CHECK and CHECK-NOT is tricky and, in general, only works if things are always in the same order.
E.g. if does v3 get emitted after v4, the test will still pass.
One way to deal with that would be to split the positive and negative checks into separate runs.
First one would check the variables we do want to keep with CHECK-DAG.
The other one would only check for the absence of the variables with -NOT.