yaron.keren added a comment. You are right, running passes over again for all but trivial code will not result in the same module. The CloneModule approach should work. Repository: rL LLVM http://reviews.llvm.org/D14965