https://github.com/preames commented: Not really sure the assert is worth the complexity here. I'd be tempted to just make the call to ExtractValue for Idx1 conditional on whether it's already in the set, and move on with life. https://github.com/llvm/llvm-project/pull/125693