[PATCH] D69561: [ThinLTO] Import readonly vars with refs

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 30 06:24:27 PDT 2019


evgeny777 added a comment.

> I can see why this is a good idea, but do you have numbers for this optimization? How much code can be inlined?

This patch doesn't directly affect inlining, though it can reduce number of IR instructions and make inline cost of a function lower.
LLVM test suite shows noticeable code size reduction of `Bullet` test case (~1%), because deallocation function pointer `sFreeFunc` is imported with initializer
and load instruction gets eliminated in few destructors (indirect call is converted to direct call). On the whole the change introduced by this patch is quite small
and I wouldn't expect much from it. It would probably work better for C programs, where function pointers in structures is common OO pattern.

Also it may become better with better readonly'ness detection (I have plans for it as well).

> Benchmark for speedup?

I've observed slightly better execution time of MultiSource test suite over several runs, but this is most likely some sort of caching issue.

> code size?

See above. There are minor size improvements for other MultiSource benchmarks, but too small to be considered.

> compile time impact?

Not observed. Typical program contains few global variables (compared to number of functions), and very few of them are readonly. Among those few have non-trivial initializer.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69561/new/

https://reviews.llvm.org/D69561





More information about the llvm-commits mailing list