Use existing functionality to strip constant offsets that works well
with AS casts and avoids the code duplication.
Since we strip AS casts during the computation of the offset we also
need to adjust the APInt properly to avoid mismatches in the bit width.
This code ensures the caller of compute sees APInts that match the
index type size of the value passed to compute, not the value result
of the strip pointer cast.
clang-format: please reformat the code