[PATCH] D42612: [GlobalOpt] Improve common case efficiency of static global initializer evaluation

Gerolf Hoflehner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 30 20:55:30 PST 2018


Gerolf added a comment.

This is very close now. Could you add an explicit examples  (eg show the IR) showing which initialization remain slow (Complex) and which are fast now? This should also address the spirit of Adrian's question I think.

Thanks
Gerolf



================
Comment at: lib/Transforms/IPO/GlobalOpt.cpp:2301
+
+  auto ValidateOrCommitCache = [&](GlobalVariable *GV, bool ForceCommit) {
+    Constant *Init = GV->getInitializer();
----------------
I admit it still hurts my eye to see back to back checks for CurrentGV and ForceCommit. How about this: I think in your final instance of the lambda it can be guaranteed that CurrentGV != null. So there could be a bool parameter 'bool Update'(instead of ForceCommit) and pass GV !=CurrentGV to Update, while on the final call Update is passed true.


Repository:
  rL LLVM

https://reviews.llvm.org/D42612





More information about the llvm-commits mailing list