
Missing information about begin and end pointers of std::vector can lead to missed optimizations in LLVM. This patch adds alignment assumptions at the point where the begin and end pointers are loaded. If the pointers would not have the same alignment, end might never get hit when incrementing begin. See https://github.com/llvm/llvm-project/issues/101372 for a discussion of missed range check optimizations in hardened mode. Once https://github.com/llvm/llvm-project/pull/108958 lands, the created `llvm.assume` calls for the alignment should be folded into the `load` instructions, resulting in no extra instructions after InstCombine. Co-authored-by: Louis Dionne <ldionne.2@gmail.com>