Yes I know it can change the bit pattern. And if it is only about the bit pattern, the name is fine. However, it seems to me that the only difference between stripPointerCastsSameBitPattern and stripPointerCasts is the AS, which may or may not be relevant to the bit pattern. This is confusing: it isn't clear to me from the name stripPointerCastsSameBitPattern whether it may strip any addrspacecast that has the same bit pattern.
To me (someone from outside LLVM), the "keep bit pattern" argument looks confusing. Pointer casts do not necessarily change the bit pattern? In fact, it seems to me that most pointer casts preserve the bit pattern but change the meaning of the pointer (example: address space 1 on AVR which points into flash instead of RAM - no bits are changed with an addrspacecast).
Fri, May 17
Move bulk of implementation to separate function
Thu, May 16
Added a test outside entry block; doesn't make any difference in the output.
By a test with no ret, do you mean something that returns void?
Fair enough. I'm not strongly opinionated here - either way is good for me.
Wed, May 15
The patch looks good. One comment - does it make sense to have two functions or unify the implementation - make the non DstOp version forward to DstOp version?