https://github.com/pmatos requested changes to this pull request. I have added a few ideas that we can improve the PR with but then we we'll still need some further passes to improve on the types behaviour. https://github.com/llvm/llvm-project/pull/148935