hfinkel added a comment. Looks right to me. Regarding a helper, the comment is longer than the code, so you should name the helper so that you can move the comment too. Maybe getObjectOffsetWrapFlags or similar. https://reviews.llvm.org/D39404