Right now, the loop that iterates over the pointers in each alias set ignores constantexpr uses of these pointers - which is unfortunate, since it misses the case where the pointer is a constant, and a constant expression that uses the pointer is present inside the loop.
I'm not too happy with this patch - it seems like there should be a simpler way to do this. Any suggestions are welcome, especially if I'm missing an obvious one.
Also, it is intentionally conservative, since it'll bail even when the constantexpr is harmless (e.g. a bitcast from i32* to float* that goes into a load). Ideally, it should probably just feed the instructions that use the constantexpr into the same loop as the rest of the pointer's users, but I'm afraid that may introduce other edge cases.
This fixes PR26843.