I don't see a way in which a pointer comparison can result in capturing a pointer that is not undefined, although I'm not all that familiar with the C/C++ standards.
I can think of a few cases:
* a comparison against a global, in which case the global was already referenced
* converting to an int and checking that: not included in CaptureTracking
* doing a GEP with large indices until one hits another pointer: UB
In all these, it seems to me that a comparison does not capture a pointer.
This is the post I'm basing myself on:
Tests haven't been added yet because I'm not all that familiar with optimization internals and I want to know whether this is even a valid optimization.