https://github.com/kyulee-com commented: Have you thought about using `llvm::MapVector` (instead of `llvm::DenseMap`) which should preserve the input/insertion order to the map, which you seem want here? https://github.com/llvm/llvm-project/pull/91159