I don't want to do just a visual compare, i would like to manipulate, iterate, over the "old" version of the function. On 14 April 2013 11:49, edA-qa mort-ora-y <eda-qa at disemia.com> wrote:> On 14/04/13 18:40, Giacomo Tagliabue wrote: > > I want to compare a program before and after having run a FunctionPass. > > The purpose is merely didactic. What I would like to do is, during the > > I do a dump of the Module (Module.print) before and after running it > through a PassManager (you could also use the Function.print method I > think). You can put just a single pass in the PassManager to compare how > the result differs. I do this often to see how optimization is changing > my code. > > > -- > edA-qa mort-ora-y > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- > Sign: Please digitally sign your emails. > Encrypt: I'm also happy to receive encrypted mail. > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130414/bae35d1a/attachment.html>
On 14/04/13 19:11, Giacomo Tagliabue wrote:> I don't want to do just a visual compare, i would like to manipulate, > iterate, over the "old" version of the function.I don't know if there is an explicit clone method, but you could do the printing and then parse it again. That would effectively create a clone of the object. Otherwise you can also try using the Linker and linking the source Module. It's not clear, but perhaps that is also creating a copy (there is a mode enum which says not to destroy the source, but I can't see where to use it). -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I'm also happy to receive encrypted mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130414/e2da9d92/attachment.sig>
On 14/04/13 19:50, edA-qa mort-ora-y wrote:> I don't know if there is an explicit clone method, but you could do the > printing and then parse it again. That would effectively create a clone > of the object.It appears the "llvm" namespace has several Clone functions. Thus you should be able to do what I suggested: Clone the function, run the original through the optimizer, and then compare the results. -- edA-qa mort-ora-y -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Sign: Please digitally sign your emails. Encrypt: I'm also happy to receive encrypted mail. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 261 bytes Desc: OpenPGP digital signature URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130414/cedc5a72/attachment.sig>