Re: [PATCH] D84261: [PGO] Supporting code for always instrumenting entry block

2020-08-17 Thread Xinliang David Li via cfe-commits
I think you are right -- the two files need to be in sync.

On Mon, Aug 17, 2020 at 1:17 PM Pavel Kosov via Phabricator via
llvm-commits  wrote:

> kpdev42 added inline comments.
>
>
> 
> Comment at: llvm/include/llvm/ProfileData/InstrProfData.inc:676
>  #define VARIANT_MASK_CSIR_PROF (0x1ULL << 57)
> +#define VARIANT_MASK_INSTR_ENTRY (0x1ULL << 58)
>  #define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version
> 
> This revision is closed, so excuse me for the question:
> Files `./llvm/include/llvm/ProfileData/InstrProfData.inc` and
> `./compiler-rt/include/profile/InstrProfData.inc` should be two identical
> copies, as stated in their description.
> ```
>  * The file has two identical copies. The master copy lives in LLVM and
>  * the other one  sits in compiler-rt/lib/profile directory. To make
> changes
>  * in this file, first modify the master copy and copy it over to
> compiler-rt.
>  * Testing of any change in this file can start only after the two copies
> are
>  * synced up.
> ```
>
>
> Should we add `VARIANT_MASK_INSTR_ENTRY` to `compiler-rt` or change
> description?
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D84261/new/
>
> https://reviews.llvm.org/D84261
>
> ___
> llvm-commits mailing list
> llvm-comm...@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84261: [PGO] Supporting code for always instrumenting entry block

2020-08-17 Thread Pavel Kosov via Phabricator via cfe-commits
kpdev42 added inline comments.



Comment at: llvm/include/llvm/ProfileData/InstrProfData.inc:676
 #define VARIANT_MASK_CSIR_PROF (0x1ULL << 57)
+#define VARIANT_MASK_INSTR_ENTRY (0x1ULL << 58)
 #define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version

This revision is closed, so excuse me for the question: 
Files `./llvm/include/llvm/ProfileData/InstrProfData.inc` and 
`./compiler-rt/include/profile/InstrProfData.inc` should be two identical 
copies, as stated in their description. 
```
 * The file has two identical copies. The master copy lives in LLVM and
 * the other one  sits in compiler-rt/lib/profile directory. To make changes
 * in this file, first modify the master copy and copy it over to compiler-rt.
 * Testing of any change in this file can start only after the two copies are
 * synced up.
```


Should we add `VARIANT_MASK_INSTR_ENTRY` to `compiler-rt` or change description?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84261

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D84261: [PGO] Supporting code for always instrumenting entry block

2020-07-22 Thread Rong Xu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG50da55a58534: [PGO] Supporting code for always instrumenting 
entry block (authored by xur).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D84261?vs=279904=279952#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84261

Files:
  clang/test/CodeGenCXX/Inputs/profile-remap_entry.proftext
  clang/test/CodeGenCXX/profile-remap.cpp
  clang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
  clang/test/Profile/gcc-flag-compatibility.c
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/include/llvm/ProfileData/InstrProfData.inc
  llvm/include/llvm/ProfileData/InstrProfReader.h
  llvm/include/llvm/ProfileData/InstrProfWriter.h
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/ProfileData/InstrProfReader.cpp
  llvm/lib/ProfileData/InstrProfWriter.cpp
  llvm/lib/Transforms/Instrumentation/CFGMST.h
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  llvm/test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/criticaledge_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/func_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-branch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch-correct_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/misexpect-switch_entry.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select1.proftext
  llvm/test/Transforms/PGOProfile/Inputs/select2.proftext
  llvm/test/Transforms/PGOProfile/Inputs/switch_entry.proftext
  llvm/test/Transforms/PGOProfile/branch2.ll
  llvm/test/Transforms/PGOProfile/counter_promo_exit_catchswitch.ll
  llvm/test/Transforms/PGOProfile/criticaledge.ll
  llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
  llvm/test/Transforms/PGOProfile/indirectbr.ll
  llvm/test/Transforms/PGOProfile/irreducible.ll
  llvm/test/Transforms/PGOProfile/landingpad.ll
  llvm/test/Transforms/PGOProfile/loop1.ll
  llvm/test/Transforms/PGOProfile/loop2.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch-stripped.ll
  llvm/test/Transforms/PGOProfile/misexpect-branch.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch-default.ll
  llvm/test/Transforms/PGOProfile/misexpect-switch.ll
  llvm/test/Transforms/PGOProfile/switch.ll
  llvm/test/Transforms/PGOProfile/thinlto_cspgo_use.ll
  llvm/test/tools/llvm-profdata/Inputs/header-directives-1.proftext
  llvm/test/tools/llvm-profdata/Inputs/header-directives-2.proftext
  llvm/test/tools/llvm-profdata/Inputs/header-directives-3.proftext
  llvm/test/tools/llvm-profdata/header-directives.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp

Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -251,6 +251,7 @@
 Filename);
 return;
   }
+  WC->Writer.setInstrEntryBBEnabled(Reader->instrEntryBBEnabled());
 
   for (auto  : *Reader) {
 if (Remapper)
@@ -977,8 +978,11 @@
   if (TextFormat)
 return 0;
   std::unique_ptr PS(Builder.getSummary());
-  OS << "Instrumentation level: "
- << (Reader->isIRLevelProfile() ? "IR" : "Front-end") << "\n";
+  bool IsIR = Reader->isIRLevelProfile();
+  OS << "Instrumentation level: " << (IsIR ? "IR" : "Front-end");
+  if (IsIR)
+OS << "  entry_first = " << Reader->instrEntryBBEnabled();
+  OS << "\n";
   if (ShowAllFunctions || !ShowFunction.empty())
 OS << "Functions shown: " << ShownFunctions << "\n";
   OS << "Total functions: " << PS->getNumFunctions() << "\n";
Index: llvm/test/tools/llvm-profdata/header-directives.test
===
--- /dev/null
+++ llvm/test/tools/llvm-profdata/header-directives.test
@@ -0,0 +1,10 @@
+RUN: llvm-profdata show %p/Inputs/header-directives-1.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
+RUN: llvm-profdata show %p/Inputs/header-directives-2.proftext -o - | FileCheck %s --check-prefixes=NOTENTRYFIRST,CHECK
+RUN: llvm-profdata show %p/Inputs/header-directives-3.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
+
+ENTRYFIRST: Instrumentation level: IR  entry_first = 1
+NOTENTRYFIRST: Instrumentation level: IR  entry_first = 0
+CHECK: Total functions: 1
+CHECK: Maximum function count: 100
+CHECK: Maximum internal block count: 90
+
Index: llvm/test/tools/llvm-profdata/Inputs/header-directives-3.proftext