Skip to content

[InstrProf] Remove -forder-file-instrumentation #130192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 13, 2025

Conversation

ellishg
Copy link
Contributor

@ellishg ellishg commented Mar 6, 2025

Completely remove -forder-file-instrumentation. This was deprecated in #121514 and removal was planned in https://discourse.llvm.org/t/deprecate-forder-file-instrumentation-in-favor-of-temporal-profiling/83903. Since LLVM 20 has been cut (https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.0), we can remove this feature.

@llvmbot llvmbot added clang Clang issues not falling into any other category compiler-rt lld clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' lld:MachO PGO Profile Guided Optimizations llvm:transforms labels Mar 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 6, 2025

@llvm/pr-subscribers-lld
@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-clang

Author: Ellis Hoag (ellishg)

Changes

Completely remove -forder-file-instrumentation. This was deprecated in #121514 and removal was planned in https://discourse.llvm.org/t/deprecate-forder-file-instrumentation-in-favor-of-temporal-profiling/83903. Since LLVM 20 has been cut (https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.0), we can remove this feature.


Patch is 44.49 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/130192.diff

27 Files Affected:

  • (modified) clang/docs/UsersManual.rst (-1)
  • (modified) clang/include/clang/Driver/Options.td (+7-9)
  • (modified) clang/lib/Driver/ToolChain.cpp (-1)
  • (modified) clang/lib/Driver/ToolChains/Clang.cpp (-15)
  • (modified) clang/lib/Driver/ToolChains/SYCL.cpp (+2-3)
  • (modified) clang/test/Driver/clang_f_opts.c (-8)
  • (modified) compiler-rt/include/profile/InstrProfData.inc (-22)
  • (modified) compiler-rt/include/profile/instr_prof_interface.h (-4)
  • (modified) compiler-rt/lib/profile/InstrProfiling.h (-3)
  • (modified) compiler-rt/lib/profile/InstrProfilingFile.c (+1-90)
  • (modified) compiler-rt/lib/profile/InstrProfilingPlatformAIX.c (+4-7)
  • (modified) compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c (-4)
  • (modified) compiler-rt/lib/profile/InstrProfilingPlatformLinux.c (-5)
  • (modified) compiler-rt/lib/profile/InstrProfilingPlatformOther.c (-4)
  • (modified) compiler-rt/lib/profile/InstrProfilingPlatformWindows.c (-3)
  • (removed) compiler-rt/test/profile/Inputs/instrprof-order-file.c (-17)
  • (removed) compiler-rt/test/profile/instrprof-order-file.test (-17)
  • (modified) lld/test/MachO/start-end.s (-18)
  • (modified) llvm/include/llvm/ProfileData/InstrProfData.inc (-22)
  • (removed) llvm/include/llvm/Transforms/Instrumentation/InstrOrderFile.h (-27)
  • (modified) llvm/lib/Passes/PassBuilder.cpp (-1)
  • (modified) llvm/lib/Passes/PassBuilderPipelines.cpp (-8)
  • (modified) llvm/lib/Passes/PassRegistry.def (-1)
  • (modified) llvm/lib/Transforms/Instrumentation/CMakeLists.txt (-1)
  • (removed) llvm/lib/Transforms/Instrumentation/InstrOrderFile.cpp (-169)
  • (removed) llvm/test/Instrumentation/InstrOrderFile/basic.ll (-23)
  • (modified) llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn (-1)
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index 8213334b61c22..f70f786c07085 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3195,7 +3195,6 @@ be collected.
    the profile file to ``Name``.
  * ``void __llvm_profile_reset_counters(void)``: resets all counters to zero.
  * ``int __llvm_profile_dump(void)``: write the profile data to disk.
- * ``int __llvm_orderfile_dump(void)``: write the order file to disk.
 
 For example, the following pattern can be used to skip profiling program
 initialization, profile two specific hot regions, and skip profiling program
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index d0414aba35209..04eb01e146853 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1811,15 +1811,13 @@ def fprofile_continuous : Flag<["-"], "fprofile-continuous">,
     HelpText<"Enable continuous instrumentation profiling mode">,
     MarshallingInfoFlag<CodeGenOpts<"ContinuousProfileSync">>;
 
-defm pseudo_probe_for_profiling : BoolFOption<"pseudo-probe-for-profiling",
-  CodeGenOpts<"PseudoProbeForProfiling">, DefaultFalse,
-  PosFlag<SetTrue, [], [ClangOption], "Emit">,
-  NegFlag<SetFalse, [], [ClangOption], "Do not emit">,
-  BothFlags<[], [ClangOption, CC1Option],
-          " pseudo probes for sample profiling">>;
-def forder_file_instrumentation : Flag<["-"], "forder-file-instrumentation">,
-    Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
-    HelpText<"Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var). Deprecated, please use -ftemporal-profile">;
+defm pseudo_probe_for_profiling
+    : BoolFOption<"pseudo-probe-for-profiling",
+                  CodeGenOpts<"PseudoProbeForProfiling">, DefaultFalse,
+                  PosFlag<SetTrue, [], [ClangOption], "Emit">,
+                  NegFlag<SetFalse, [], [ClangOption], "Do not emit">,
+                  BothFlags<[], [ClangOption, CC1Option],
+                            " pseudo probes for sample profiling">>;
 def fprofile_list_EQ : Joined<["-"], "fprofile-list=">,
     Group<f_Group>, Visibility<[ClangOption, CC1Option, CLOption]>,
     HelpText<"Filename defining the list of functions/files to instrument. "
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 65acbe8a9dbea..7700321b7b8cb 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -952,7 +952,6 @@ bool ToolChain::needsProfileRT(const ArgList &Args) {
          Args.hasArg(options::OPT_fprofile_instr_generate) ||
          Args.hasArg(options::OPT_fprofile_instr_generate_EQ) ||
          Args.hasArg(options::OPT_fcreate_profile) ||
-         Args.hasArg(options::OPT_forder_file_instrumentation) ||
          Args.hasArg(options::OPT_fprofile_generate_cold_function_coverage) ||
          Args.hasArg(options::OPT_fprofile_generate_cold_function_coverage_EQ);
 }
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 4ebbd241d2f0b..9732890d55968 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -8031,21 +8031,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     }
   }
 
-  if (const Arg *A =
-          Args.getLastArg(options::OPT_forder_file_instrumentation)) {
-    D.Diag(diag::warn_drv_deprecated_arg)
-        << A->getAsString(Args) << /*hasReplacement=*/true
-        << "-ftemporal-profile";
-    CmdArgs.push_back("-forder-file-instrumentation");
-    // Enable order file instrumentation when ThinLTO is not on. When ThinLTO is
-    // on, we need to pass these flags as linker flags and that will be handled
-    // outside of the compiler.
-    if (!IsUsingLTO) {
-      CmdArgs.push_back("-mllvm");
-      CmdArgs.push_back("-enable-order-file-instrumentation");
-    }
-  }
-
   if (Arg *A = Args.getLastArg(options::OPT_fforce_enable_int128,
                                options::OPT_fno_force_enable_int128)) {
     if (A->getOption().matches(options::OPT_fforce_enable_int128))
diff --git a/clang/lib/Driver/ToolChains/SYCL.cpp b/clang/lib/Driver/ToolChains/SYCL.cpp
index a2b07ef4824a1..a9f5317a77c2f 100644
--- a/clang/lib/Driver/ToolChains/SYCL.cpp
+++ b/clang/lib/Driver/ToolChains/SYCL.cpp
@@ -49,9 +49,8 @@ static ArrayRef<options::ID> getUnsupportedOpts() {
       options::OPT_fno_profile_arcs, // -f[no-]profile-arcs
       options::OPT_fcreate_profile,  // -fcreate-profile
       options::OPT_fprofile_instr_use,
-      options::OPT_fprofile_instr_use_EQ,       // -fprofile-instr-use
-      options::OPT_forder_file_instrumentation, // -forder-file-instrumentation
-      options::OPT_fcs_profile_generate,        // -fcs-profile-generate
+      options::OPT_fprofile_instr_use_EQ, // -fprofile-instr-use
+      options::OPT_fcs_profile_generate,  // -fcs-profile-generate
       options::OPT_fcs_profile_generate_EQ,
   };
   return UnsupportedOpts;
diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c
index 7454ce3d30f5f..f6bf71417e6f8 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -110,8 +110,6 @@
 // RUN: %clang -### -S -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
 // RUN: %clang -### -S -fprofile-instr-generate -fcoverage-mapping -fno-coverage-mapping %s 2>&1 | FileCheck -check-prefix=CHECK-DISABLE-COVERAGE %s
 // RUN: %clang -### -S -fprofile-remapping-file=foo/bar.txt %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-REMAP %s
-// RUN: %clang -### -S -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR %s
-// RUN: %clang -### --target=x86_64-linux-gnu -flto -forder-file-instrumentation %s 2>&1 | FileCheck -check-prefix=CHECK-ORDERFILE-INSTR-LTO %s
 // CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
 // CHECK-PROFILE-GENERATE-LLVM: "-fprofile-instrument=llvm"
 // CHECK-PROFILE-GENERATE-DIR: "-fprofile-instrument-path=/some/dir{{/|\\\\}}{{.*}}"
@@ -123,10 +121,6 @@
 // CHECK-COVERAGE-AND-GEN: '-fcoverage-mapping' only allowed with '-fprofile-instr-generate'
 // CHECK-DISABLE-COVERAGE-NOT: "-fcoverage-mapping"
 // CHECK-PROFILE-REMAP: "-fprofile-remapping-file=foo/bar.txt"
-// CHECK-ORDERFILE-INSTR: "-forder-file-instrumentation"
-// CHECK-ORDERFILE-INSTR: "-enable-order-file-instrumentation"
-// CHECK-ORDERFILE-INSTR-LTO: "-forder-file-instrumentation"
-// CHECK-ORDERFILE-INSTR-LTO-NOT: "-enable-order-file-instrumentation"
 
 // RUN: %clang -### -S -fprofile-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
 // RUN: %clang -### -S -fprofile-instr-use %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
@@ -371,7 +365,6 @@
 // RUN: -fno-devirtualize-speculatively                                       \
 // RUN: -fslp-vectorize-aggressive                                            \
 // RUN: -fno-slp-vectorize-aggressive                                         \
-// RUN: -forder-file-instrumentation                                          \
 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
@@ -431,7 +424,6 @@
 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is not supported
 // CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been deprecated and will be ignored
 // CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been deprecated and will be ignored
-// CHECK-WARNING-DAG: argument '-forder-file-instrumentation' is deprecated, use '-ftemporal-profile' instead
 
 // Test that we mute the warning on these
 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument              \
diff --git a/compiler-rt/include/profile/InstrProfData.inc b/compiler-rt/include/profile/InstrProfData.inc
index 39613da81ecb4..2cdfea9a579a4 100644
--- a/compiler-rt/include/profile/InstrProfData.inc
+++ b/compiler-rt/include/profile/InstrProfData.inc
@@ -348,9 +348,6 @@ INSTR_PROF_SECT_ENTRY(IPSK_covmap, \
 INSTR_PROF_SECT_ENTRY(IPSK_covfun, \
                       INSTR_PROF_QUOTE(INSTR_PROF_COVFUN_COMMON), \
                       INSTR_PROF_COVFUN_COFF, "__LLVM_COV,")
-INSTR_PROF_SECT_ENTRY(IPSK_orderfile, \
-                      INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON), \
-                      INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COFF), "__DATA,")
 INSTR_PROF_SECT_ENTRY(IPSK_covdata, \
                       INSTR_PROF_QUOTE(INSTR_PROF_COVDATA_COMMON), \
                       INSTR_PROF_COVDATA_COFF, "__LLVM_COV,")
@@ -778,7 +775,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
 #define INSTR_PROF_COVFUN_COMMON __llvm_covfun
 #define INSTR_PROF_COVDATA_COMMON __llvm_covdata
 #define INSTR_PROF_COVNAME_COMMON __llvm_covnames
-#define INSTR_PROF_ORDERFILE_COMMON __llvm_orderfile
 #define INSTR_PROF_COVINIT_COMMON __llvm_covinit
 
 /* Windows section names. Because these section names contain dollar characters,
@@ -799,7 +795,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
  */
 #define INSTR_PROF_COVDATA_COFF ".lcovd"
 #define INSTR_PROF_COVNAME_COFF ".lcovn"
-#define INSTR_PROF_ORDERFILE_COFF ".lorderfile$M"
 
 // FIXME: Placeholder for Windows. Windows currently does not initialize
 // the GCOV functions in the runtime.
@@ -823,7 +818,6 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
 #define INSTR_PROF_COVFUN_SECT_NAME INSTR_PROF_COVFUN_COFF
 #define INSTR_PROF_COVDATA_SECT_NAME INSTR_PROF_COVDATA_COFF
 #define INSTR_PROF_COVNAME_SECT_NAME INSTR_PROF_COVNAME_COFF
-#define INSTR_PROF_ORDERFILE_SECT_NAME INSTR_PROF_ORDERFILE_COFF
 #define INSTR_PROF_COVINIT_SECT_NAME INSTR_PROF_COVINIT_COFF
 #else
 /* Runtime section names and name strings.  */
@@ -843,19 +837,9 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
 #define INSTR_PROF_COVFUN_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVFUN_COMMON)
 #define INSTR_PROF_COVDATA_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVDATA_COMMON)
 #define INSTR_PROF_COVNAME_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVNAME_COMMON)
-/* Order file instrumentation. */
-#define INSTR_PROF_ORDERFILE_SECT_NAME                                         \
-  INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_COMMON)
 #define INSTR_PROF_COVINIT_SECT_NAME INSTR_PROF_QUOTE(INSTR_PROF_COVINIT_COMMON)
 #endif
 
-#define INSTR_PROF_ORDERFILE_BUFFER_NAME _llvm_order_file_buffer
-#define INSTR_PROF_ORDERFILE_BUFFER_NAME_STR                                   \
-  INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_NAME)
-#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME _llvm_order_file_buffer_idx
-#define INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME_STR                               \
-  INSTR_PROF_QUOTE(INSTR_PROF_ORDERFILE_BUFFER_IDX_NAME)
-
 /* Macros to define start/stop section symbol for a given
  * section on Linux. For instance
  * INSTR_PROF_SECT_START(INSTR_PROF_DATA_SECT_NAME) will
@@ -889,12 +873,6 @@ typedef struct InstrProfValueData {
 
 #endif /* INSTR_PROF_DATA_INC */
 
-#ifndef INSTR_ORDER_FILE_INC
-/* The maximal # of functions: 128*1024 (the buffer size will be 128*4 KB). */
-#define INSTR_ORDER_FILE_BUFFER_SIZE 131072
-#define INSTR_ORDER_FILE_BUFFER_BITS 17
-#define INSTR_ORDER_FILE_BUFFER_MASK 0x1ffff
-#endif /* INSTR_ORDER_FILE_INC */
 #else
 #undef INSTR_PROF_DATA_DEFINED
 #endif
diff --git a/compiler-rt/include/profile/instr_prof_interface.h b/compiler-rt/include/profile/instr_prof_interface.h
index be40f2685934b..678cea094a7f3 100644
--- a/compiler-rt/include/profile/instr_prof_interface.h
+++ b/compiler-rt/include/profile/instr_prof_interface.h
@@ -73,15 +73,11 @@ void __llvm_profile_reset_counters(void);
  */
 int __llvm_profile_dump(void);
 
-// Interface to dump the current process' order file to disk.
-int __llvm_orderfile_dump(void);
-
 #else
 
 #define __llvm_profile_set_filename(Name)
 #define __llvm_profile_reset_counters()
 #define __llvm_profile_dump() (0)
-#define __llvm_orderfile_dump() (0)
 
 #endif
 
diff --git a/compiler-rt/lib/profile/InstrProfiling.h b/compiler-rt/lib/profile/InstrProfiling.h
index eaa4ab52c243d..77c8d6c79322d 100644
--- a/compiler-rt/lib/profile/InstrProfiling.h
+++ b/compiler-rt/lib/profile/InstrProfiling.h
@@ -124,7 +124,6 @@ ValueProfNode *__llvm_profile_begin_vnodes(void);
 ValueProfNode *__llvm_profile_end_vnodes(void);
 const VTableProfData *__llvm_profile_begin_vtables(void);
 const VTableProfData *__llvm_profile_end_vtables(void);
-uint32_t *__llvm_profile_begin_orderfile(void);
 
 /*!
  * \brief Merge profile data from buffer.
@@ -175,8 +174,6 @@ void __llvm_profile_instrument_target_value(uint64_t TargetValue, void *Data,
  */
 int __llvm_profile_write_file(void);
 
-int __llvm_orderfile_write_file(void);
-
 /*!
  * \brief Set the FILE object for writing instrumentation data. Return 0 if set
  * successfully or return 1 if failed.
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index e5eca7947cf9b..ce5aa9a8fd328 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -357,15 +357,6 @@ static uint32_t fileWriter(ProfDataWriter *This, ProfDataIOVec *IOVecs,
   return 0;
 }
 
-/* TODO: make buffer size controllable by an internal option, and compiler can pass the size
-   to runtime via a variable. */
-static uint32_t orderFileWriter(FILE *File, const uint32_t *DataStart) {
-  if (fwrite(DataStart, sizeof(uint32_t), INSTR_ORDER_FILE_BUFFER_SIZE, File) !=
-      INSTR_ORDER_FILE_BUFFER_SIZE)
-    return 1;
-  return 0;
-}
-
 static void initFileWriter(ProfDataWriter *This, FILE *File) {
   This->Write = fileWriter;
   This->WriterCtx = File;
@@ -503,7 +494,7 @@ static void createProfileDir(const char *Filename) {
  * the original profile data is truncated and gets ready for the profile
  * dumper. With profile merging enabled, each executable as well as any of
  * its instrumented shared libraries dump profile data into their own data file.
-*/
+ */
 static FILE *openFileForMerging(const char *ProfileFileName, int *MergeDone) {
   FILE *ProfileFile = getProfileFile();
   int rc;
@@ -577,27 +568,6 @@ static int writeFile(const char *OutputName) {
   return RetVal;
 }
 
-/* Write order data to file \c OutputName.  */
-static int writeOrderFile(const char *OutputName) {
-  int RetVal;
-  FILE *OutputFile;
-
-  OutputFile = fopen(OutputName, "w");
-
-  if (!OutputFile) {
-    PROF_WARN("can't open file with mode ab: %s\n", OutputName);
-    return -1;
-  }
-
-  FreeHook = &free;
-  setupIOBuffer();
-  const uint32_t *DataBegin = __llvm_profile_begin_orderfile();
-  RetVal = orderFileWriter(OutputFile, DataBegin);
-
-  fclose(OutputFile);
-  return RetVal;
-}
-
 #define LPROF_INIT_ONCE_ENV "__LLVM_PROFILE_RT_INIT_ONCE"
 
 static void truncateCurrentFile(void) {
@@ -1239,65 +1209,6 @@ int __llvm_profile_dump(void) {
   return rc;
 }
 
-/* Order file data will be saved in a file with suffx .order. */
-static const char *OrderFileSuffix = ".order";
-
-COMPILER_RT_VISIBILITY
-int __llvm_orderfile_write_file(void) {
-  int rc, Length, LengthBeforeAppend, SuffixLength;
-  const char *Filename;
-  char *FilenameBuf;
-
-  // Temporarily suspend getting SIGKILL when the parent exits.
-  int PDeathSig = lprofSuspendSigKill();
-
-  SuffixLength = strlen(OrderFileSuffix);
-  Length = getCurFilenameLength() + SuffixLength;
-  FilenameBuf = (char *)COMPILER_RT_ALLOCA(Length + 1);
-  Filename = getCurFilename(FilenameBuf, 1);
-
-  /* Check the filename. */
-  if (!Filename) {
-    PROF_ERR("Failed to write file : %s\n", "Filename not set");
-    if (PDeathSig == 1)
-      lprofRestoreSigKill();
-    return -1;
-  }
-
-  /* Append order file suffix */
-  LengthBeforeAppend = strlen(Filename);
-  memcpy(FilenameBuf + LengthBeforeAppend, OrderFileSuffix, SuffixLength);
-  FilenameBuf[LengthBeforeAppend + SuffixLength] = '\0';
-
-  /* Check if there is llvm/runtime version mismatch.  */
-  if (GET_VERSION(__llvm_profile_get_version()) != INSTR_PROF_RAW_VERSION) {
-    PROF_ERR("Runtime and instrumentation version mismatch : "
-             "expected %d, but get %d\n",
-             INSTR_PROF_RAW_VERSION,
-             (int)GET_VERSION(__llvm_profile_get_version()));
-    if (PDeathSig == 1)
-      lprofRestoreSigKill();
-    return -1;
-  }
-
-  /* Write order data to the file. */
-  rc = writeOrderFile(Filename);
-  if (rc)
-    PROF_ERR("Failed to write file \"%s\": %s\n", Filename, strerror(errno));
-
-  // Restore SIGKILL.
-  if (PDeathSig == 1)
-    lprofRestoreSigKill();
-
-  return rc;
-}
-
-COMPILER_RT_VISIBILITY
-int __llvm_orderfile_dump(void) {
-  int rc = __llvm_orderfile_write_file();
-  return rc;
-}
-
 static void writeFileWithoutReturn(void) { __llvm_profile_write_file(); }
 
 COMPILER_RT_VISIBILITY
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
index 651f8785d0b94..9cb313bc7a1fc 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformAIX.c
@@ -196,8 +196,6 @@ static const int dummy_name[0] COMPILER_RT_SECTION(
     COMPILER_RT_SEG INSTR_PROF_NAME_SECT_NAME);
 static int dummy_vnds[0] COMPILER_RT_SECTION(
     COMPILER_RT_SEG INSTR_PROF_VNODES_SECT_NAME);
-static int dummy_orderfile[0] COMPILER_RT_SECTION(
-    COMPILER_RT_SEG INSTR_PROF_ORDERFILE_SECT_NAME);
 static int dummy_vname[0] COMPILER_RT_SECTION(
     COMPILER_RT_SEG INSTR_PROF_VNAME_SECT_NAME);
 static int dummy_vtab[0] COMPILER_RT_SECTION(
@@ -213,11 +211,10 @@ static int dummy_covinit_funcs[0] COMPILER_RT_SECTION(
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 COMPILER_RT_VISIBILITY
-void *__llvm_profile_keep[] = {(void *)&dummy_cnts,  (void *)&dummy_bits,
-                               (void *)&dummy_data,  (void *)&dummy_name,
-                               (void *)&dummy_vnds,  (void *)&dummy_orderfile,
-                               (void *)&dummy_vname, (void *)&dummy_vtab,
-                               (void *)&dummy_covinit_funcs};
+void *__llvm_profile_keep[] = {
+    (void *)&dummy_cnts, (void *)&dummy_bits,         (void *)&dummy_data,
+    (void *)&dummy_name, (void *)&dummy_vnds,         (void *)&dummy_vname,
+    (void *)&dummy_vtab, (void *)&dummy_covinit_funcs};
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
index 6adc7f328cbf7..8c682ae118358 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformDarwin.c
@@ -47,8 +47,6 @@ extern char
 COMPILER_RT_VISIBILITY
 extern char VNameEnd __asm("section$end$__DATA$" INSTR_PROF_VNAME_SECT_NAME);
 COMPILER_RT_VISIBILITY
-extern uint32_t
-    OrderFileStart __asm("section$start$__DATA$" INSTR_PROF_ORDERFILE_SECT_NAME);
 
 COMPILER_RT_VISIBILITY
 extern ValueProfNode
@@ -87,8 +85,6 @@ COMPILER_RT_VISIBILITY
 const char *__llvm_profile_begin_vtabnames(void) { return &VNameStart; }
 COMPILER_RT_VISIBILITY
 const char *__llvm_profile_end_vtabnames(void) { return &VNameEnd; }
-COMPILER_RT_VISIBILITY
-uint32_t *__llvm_profile_begin_orderfile(void) { return &OrderFileStart; }
 
 COMPILER_RT_VISIBILITY
 ValueProfNode *__llvm_profile_begin_vnodes(void) {
diff --git a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
index 5b230c1b20062..558b7fc8cad62 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -32,7 +32,6 @@
 #define PROF_VTABLE_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_VTAB_COMMON)
 #define PROF_BITS_START INSTR_PROF_SECT_START(INSTR_PROF_BITS_COMMON)
 #define PROF_BITS_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_BITS_COMMON)
-#define PROF_ORDERFILE_START INSTR_PROF_SECT_START(INSTR_PROF_ORDERFILE_COMMON)
 #define PROF_VNODES_START INSTR_PROF_SECT_START(INSTR_PROF_VNODES_COMMON)
 #define PROF_VNODES_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_VNODES_COMMON)
 #define PROF_COVINIT_START INSTR_PROF_SECT_START(INSTR_PROF_COVINIT_COMMON)
@@ -53,7 +52,6 @@ extern char PROF_VNAME_START COMPILER_RT_VI...
[truncated]

@ellishg ellishg merged commit 2044dd0 into llvm:main Mar 13, 2025
12 checks passed
@ellishg ellishg deleted the remove-order-file-instrumentation branch March 13, 2025 15:28
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 13, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building clang,compiler-rt,lld,llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2481

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/82/95' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-19696-82-95.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=95 GTEST_SHARD_INDEX=82 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


frederik-h pushed a commit to frederik-h/llvm-project that referenced this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category compiler-rt lld:MachO lld llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants