[libcxx-commits] [libcxx] [libc++] Stop emit range opt assumptions volatile pointers (PR #213719)

Kyungtak Woo via libcxx-commits libcxx-commits at lists.llvm.org
Mon Aug 3 13:49:28 PDT 2026


kevinwkt wrote:

Updated with the following changes:
__is_valid_range: Updated parameter types from const _Tp* to const volatile _Tp* so internal range ordering debug assertions (_LIBCPP_ASSERT_INTERNAL) work with volatile iterators.
__assume_valid_range: Checked !is_volatile<__remove_pointer_t<...>>::value before invoking memory optimization builtins, ensuring volatile accesses (such as memory-mapped registers or hardware barriers) are excluded from optimization assumptions and loop vectorization.
Tests: Added libcxx/test/libcxx/algorithms/volatile_pointers.pass.cpp (structured similarly to your unaligned_empty_range.pass.cpp), verifying std::find, std::find_if, std::all_of, std::any_of, etc. (along with their C++20 ranges:: counterparts) over volatile pointers.

@ldionne  Ready for another look when you have a chance!



https://github.com/llvm/llvm-project/pull/213719


More information about the libcxx-commits mailing list