[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [llvm] [lldb] [mlir] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-09 Thread Fangrui Song via lldb-commits


@@ -1331,6 +1336,18 @@ static int merge_main(int argc, const char *argv[]) {
"(default: 1)"));
 
   cl::ParseCommandLineOptions(argc, argv, "LLVM profile data merger\n");
+  if (!DebugInfoFilename.empty() && !BinaryFilename.empty()) {
+exitWithError("Expected only one of -debug-info, -binary-file");
+  }
+  std::string CorrelateFilename = "";

MaskRay wrote:

remove `= ""`

https://github.com/llvm/llvm-project/pull/69493
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang-tools-extra] [compiler-rt] [flang] [llvm] [lldb] [mlir] [clang] [Profile] Add binary profile correlation to offload profile metadata at runtime. (PR #69493)

2023-11-09 Thread Fangrui Song via lldb-commits


@@ -1829,6 +1833,22 @@ void CoverageMappingModuleGen::emit() {
  llvm::GlobalValue::InternalLinkage, NamesArrVal,
  llvm::getCoverageUnusedNamesVarName());
   }
+  const StringRef VarName(INSTR_PROF_QUOTE(INSTR_PROF_RAW_VERSION_VAR));
+  llvm::Type *IntTy64 = llvm::Type::getInt64Ty(Ctx);
+  uint64_t ProfileVersion = INSTR_PROF_RAW_VERSION;
+  if (llvm::ProfileCorrelate == llvm::InstrProfCorrelator::BINARY)
+ProfileVersion |= VARIANT_MASK_BIN_CORRELATE;
+  auto *VersionVariable = new llvm::GlobalVariable(
+  CGM.getModule(), llvm::Type::getInt64Ty(Ctx), true,
+  llvm::GlobalValue::WeakAnyLinkage,
+  llvm::Constant::getIntegerValue(IntTy64, llvm::APInt(64, 
ProfileVersion)),
+  VarName);
+  VersionVariable->setVisibility(llvm::GlobalValue::HiddenVisibility);
+  llvm::Triple TT(CGM.getModule().getTargetTriple());
+  if (TT.supportsCOMDAT()) {

MaskRay wrote:

`CGM.getTriple().supportsCOMDAT()`

https://github.com/llvm/llvm-project/pull/69493
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits