https://github.com/jayfoad commented: Looks OK to me. I find the mixture of checking `isValid` vs checking for an explicit `~0U` pretty ugly, but maybe that's inevitable for a sentinel-terminated list. https://github.com/llvm/llvm-project/pull/119122