[PATCH] D17302: [LTO] Support Statistics

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 12:16:26 PST 2016


Can you add a test to test/tools/lto?

On 16 February 2016 at 15:09, Adam Nemet via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> anemet created this revision.
> anemet added reviewers: dexonsmith, joker.eph.
> anemet added a subscriber: llvm-commits.
> Herald added a subscriber: joker.eph.
>
> I thought -Xlinker -mllvm -Xlinker -stats worked at some point but maybe
> it never did.
>
> For clang, I believe that stats are printed from cc1_main.  This patch
> also prints them for LTO, specifically right after codegen happens.
>
> I only looked at the C API for LTO briefly to see if this is a good
> place.  Probably there are still cases where this wouldn't be printed
> but it seems to be working for the common case.  I also experimented
> putting this in the LTOCodeGenerator destructor but that didn't trigger
> for me.
>
> http://reviews.llvm.org/D17302
>
> Files:
>   lib/LTO/LTOCodeGenerator.cpp
>
> Index: lib/LTO/LTOCodeGenerator.cpp
> ===================================================================
> --- lib/LTO/LTOCodeGenerator.cpp
> +++ lib/LTO/LTOCodeGenerator.cpp
> @@ -13,6 +13,7 @@
>  //===----------------------------------------------------------------------===//
>
>  #include "llvm/LTO/LTOCodeGenerator.h"
> +#include "llvm/ADT/Statistic.h"
>  #include "llvm/ADT/StringExtras.h"
>  #include "llvm/Analysis/Passes.h"
>  #include "llvm/Analysis/TargetLibraryInfo.h"
> @@ -553,6 +554,10 @@
>                     RelocModel, CodeModel::Default, CGOptLevel, FileType,
>                     ShouldRestoreGlobalsLinkage);
>
> +  // If statistics were requested, print them out after codegen.
> +  if (llvm::AreStatisticsEnabled())
> +    llvm::PrintStatistics();
> +
>    return true;
>  }
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>


More information about the llvm-commits mailing list