I’m not sure how good is wllvm but Clang already can do this out of the box through LTO + embedded bitcode: