[LSV] Return same bitwidth from getConstantOffset.
Previously, getConstantOffset could return an APInt with a different bitwidth than the input pointers. For example, we might be loading an opaque 64-bit pointer, but stripAndAccumulateInBoundsConstantOffsets might give a 32-bit offset. This was OK in most cases because in gatherChains, we casted the APInt back to the original ASPtrBits. But it was not OK when considering selects. We'd call getConstantOffset twice and compare the resulting APInt's, which might not have the same bit width. This fixes that. Now getConstantOffset always returns offsets with the correct width, so we don't need the hack of casting it in gatherChains, and it works correctly when we're handling selects. Differential Revision: https://reviews.llvm.org/D151640
Loading
Please sign in to comment