https://github.com/kuhar requested changes to this pull request. Thanks for taking a stab at this! I think we can simplify the code, but do let me know if I missed something there. https://github.com/llvm/llvm-project/pull/68495