When a non-escaping pointer is compared to a global value, the comparison can be folded even if the corresponding malloc/allocation call cannot be elided.
We need to make sure the global value is not null, since comparisons to null cannot be folded.
In future, we should also handle cases when the the comparison instruction dominates the pointer escape.