Avoid strict aliasing violation on type punning inside llvm::PointerIntPair
llvm::PointerIntPair has methods that when used together can invoke
undefined behavior by violating strict aliasing.
`getPointer()` uses the underlying storage as it's declared: `intptr_t`
`getAddrOfPointer()` casts the underlying storage as if it was a
`PointerTy`
This violates strict aliasing, so depending on how they are used, it's
possible to have the compiler to optimize the code in unwanted ways.
See the unit test in the patch. We declare a `PointerIntPair` and use
the `getAddrOfPointer` method to fill in the a pointer value. Then,
when we use `getPointer` the compiler is thrown off, thinking that
`intptr_t` storage could not have possibly be changed, and the check
fails.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D124571