https://github.com/simon-camp approved this pull request. Two small comments, otherwise this looks good to me. Regarding Jaques comments I would also start with this simpler version and think about generalizing on a need driven basis. https://github.com/llvm/llvm-project/pull/68206