Dr.-Ing. Christoph Cullmann via llvm-dev
2017-Jun-05 14:30 UTC
[llvm-dev] Question about llvm::Value::print performance
Hi, I want to use llvm::Value::print to output the assembly strings for llvm::Instructions inside a rather large llvm::Module (linked module with lots of types/...). I started with plain ::print and switched over to http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a04e6fc765eeb0c4c90ac5d55113db116 with a ModuleSlotTracker I pass in myself to avoid some complexity. Still now I have the issue that the TypeFinder::run and related that is done internally by each print still is 99% of my program runtime. (at least perf tells me that) Is there any clever workaround for this? I looked a bit through the sources but it seems that no API is exported that would allow a faster print call. Given I want the output only more or less as "debugging" annotation to my graph, is there some other "fast" way to print instructions, even if some info is missing then? Greetings Christoph -- ----------------------------- Dr.-Ing. Christoph Cullmann --------- AbsInt Angewandte Informatik GmbH Email: cullmann at AbsInt.com Science Park 1 Tel: +49-681-38360-22 66123 Saarbrücken Fax: +49-681-38360-20 GERMANY WWW: http://www.AbsInt.com -------------------------------------------------------------------- Geschäftsführung: Dr.-Ing. Christian Ferdinand Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234
Thomas Krüger via llvm-dev
2017-Jun-05 14:38 UTC
[llvm-dev] Question about llvm::Value::print performance
Hi Christoph, maybe there is a way of caching the print outputs and output them at the end of the program execution? So, your real application do not have this kind of bottle neck. Best regards, Thomas Am 05.06.2017 16:30 schrieb Dr.-Ing. Christoph Cullmann via llvm-dev:> Hi, > > I want to use llvm::Value::print to output the assembly strings for > llvm::Instructions > inside a rather large llvm::Module (linked module with lots of > types/...). > > I started with plain ::print and switched over to > > http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a04e6fc765eeb0c4c90ac5d55113db116 > > with a ModuleSlotTracker I pass in myself to avoid some complexity. > > Still now I have the issue that the TypeFinder::run and related that > is done internally > by each print still is 99% of my program runtime. (at least perf tells > me that) > > Is there any clever workaround for this? > > I looked a bit through the sources but it seems that no API is > exported that would allow a faster print > call. > > Given I want the output only more or less as "debugging" annotation to > my graph, is there some other > "fast" way to print instructions, even if some info is missing then? > > Greetings > Christoph
Dr.-Ing. Christoph Cullmann via llvm-dev
2017-Jun-05 14:43 UTC
[llvm-dev] Question about llvm::Value::print performance
Dear Thomas,> Hi Christoph, > > maybe there is a way of caching the print outputs and output them at the > end of the program execution? > So, your real application do not have this kind of bottle neck.this is a valid idea, thought the problem is: I output all things only "once" and I even output it like: 1) load module 2) go over functions 3) output all blocks with instructions in the current function That allows to e.g. use ModuleSlotTracker to compute the <label> comments of blocks fast, as each function is only visited once. Still, the performance drop to just print each instruction once is "large", without instruction printing my control flow graph construction works in ~1 second, with printing I aborted after some minutes the execution. (the module is really large, linked full graph of some medium sized application, around 5000 functions and 500k instructions and a lot of debug/type info) If there is some way that I precompute things on my own, I would really like to use that, but I don't see a way to do that. Greetings Christoph> > Best regards, > Thomas > > Am 05.06.2017 16:30 schrieb Dr.-Ing. Christoph Cullmann via llvm-dev: >> Hi, >> >> I want to use llvm::Value::print to output the assembly strings for >> llvm::Instructions >> inside a rather large llvm::Module (linked module with lots of >> types/...). >> >> I started with plain ::print and switched over to >> >> http://llvm.org/docs/doxygen/html/classllvm_1_1Value.html#a04e6fc765eeb0c4c90ac5d55113db116 >> >> with a ModuleSlotTracker I pass in myself to avoid some complexity. >> >> Still now I have the issue that the TypeFinder::run and related that >> is done internally >> by each print still is 99% of my program runtime. (at least perf tells >> me that) >> >> Is there any clever workaround for this? >> >> I looked a bit through the sources but it seems that no API is >> exported that would allow a faster print >> call. >> >> Given I want the output only more or less as "debugging" annotation to >> my graph, is there some other >> "fast" way to print instructions, even if some info is missing then? >> >> Greetings >> Christoph > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- ----------------------------- Dr.-Ing. Christoph Cullmann --------- AbsInt Angewandte Informatik GmbH Email: cullmann at AbsInt.com Science Park 1 Tel: +49-681-38360-22 66123 Saarbrücken Fax: +49-681-38360-20 GERMANY WWW: http://www.AbsInt.com -------------------------------------------------------------------- Geschäftsführung: Dr.-Ing. Christian Ferdinand Eingetragen im Handelsregister des Amtsgerichts Saarbrücken, HRB 11234