Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add IR Profile-Guided Optimization (IR PGO) support to the Flang compiler #136098

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 19 commits into from
May 30, 2025

Conversation

fanju110
Copy link
Contributor

This patch implements IR-based Profile-Guided Optimization support in Flang through the following flags:

  • -fprofile-generate for instrumentation-based profile generation

  • -fprofile-use=<dir>/file for profile-guided optimization

Resolves #74216 (implements IR PGO support phase)

Key changes:

  • Frontend flag handling aligned with Clang/GCC semantics

  • Instrumentation hooks into LLVM PGO infrastructure

  • LIT tests verifying:

    • Instrumentation metadata generation

    • Profile loading from specified path

    • Branch weight attribution (IR checks)

Tests:

  • Added gcc-flag-compatibility.f90 test module verifying:

    • Flag parsing boundary conditions

    • IR-level profile annotation consistency

    • Profile input path normalization rules

  • SPEC2006 benchmark results will be shared in comments

For details on LLVM's PGO framework, refer to Clang PGO Documentation.

This implementation was developed by XSCC Compiler Team.

This patch implements IR-based Profile-Guided Optimization support in Flang through the following flags:
-fprofile-generate for instrumentation-based profile generation
-fprofile-use=<dir>/file for profile-guided optimization

Co-Authored-By: ict-ql <[email protected]>
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' flang:driver flang Flang issues not falling into any other category labels Apr 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 17, 2025

@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-flang-driver

Author: FYK (fanju110)

Changes

This patch implements IR-based Profile-Guided Optimization support in Flang through the following flags:

  • -fprofile-generate for instrumentation-based profile generation

  • -fprofile-use=&lt;dir&gt;/file for profile-guided optimization

Resolves #74216 (implements IR PGO support phase)

Key changes:

  • Frontend flag handling aligned with Clang/GCC semantics

  • Instrumentation hooks into LLVM PGO infrastructure

  • LIT tests verifying:

    • Instrumentation metadata generation

    • Profile loading from specified path

    • Branch weight attribution (IR checks)

Tests:

  • Added gcc-flag-compatibility.f90 test module verifying:

    • Flag parsing boundary conditions

    • IR-level profile annotation consistency

    • Profile input path normalization rules

  • SPEC2006 benchmark results will be shared in comments

For details on LLVM's PGO framework, refer to Clang PGO Documentation.

This implementation was developed by XSCC Compiler Team.


Full diff: https://github.com/llvm/llvm-project/pull/136098.diff

10 Files Affected:

  • (modified) clang/include/clang/Driver/Options.td (+2-2)
  • (modified) clang/lib/Driver/ToolChains/Flang.cpp (+8)
  • (modified) flang/include/flang/Frontend/CodeGenOptions.def (+5)
  • (modified) flang/include/flang/Frontend/CodeGenOptions.h (+49)
  • (modified) flang/lib/Frontend/CompilerInvocation.cpp (+12)
  • (modified) flang/lib/Frontend/FrontendActions.cpp (+54)
  • (modified) flang/test/Driver/flang-f-opts.f90 (+5)
  • (added) flang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext (+19)
  • (added) flang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext (+14)
  • (added) flang/test/Profile/gcc-flag-compatibility.f90 (+39)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index affc076a876ad..0b0dbc467c1e0 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1756,7 +1756,7 @@ def fmcdc_max_test_vectors_EQ : Joined<["-"], "fmcdc-max-test-vectors=">,
   HelpText<"Maximum number of test vectors in MC/DC coverage">,
   MarshallingInfoInt<CodeGenOpts<"MCDCMaxTVs">, "0x7FFFFFFE">;
 def fprofile_generate : Flag<["-"], "fprofile-generate">,
-    Group<f_Group>, Visibility<[ClangOption, CLOption]>,
+    Group<f_Group>, Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>,
     HelpText<"Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)">;
 def fprofile_generate_EQ : Joined<["-"], "fprofile-generate=">,
     Group<f_Group>, Visibility<[ClangOption, CLOption]>,
@@ -1773,7 +1773,7 @@ def fprofile_use : Flag<["-"], "fprofile-use">, Group<f_Group>,
     Visibility<[ClangOption, CLOption]>, Alias<fprofile_instr_use>;
 def fprofile_use_EQ : Joined<["-"], "fprofile-use=">,
     Group<f_Group>,
-    Visibility<[ClangOption, CLOption]>,
+    Visibility<[ClangOption, CLOption, FlangOption, FC1Option]>,
     MetaVarName<"<pathname>">,
     HelpText<"Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.">;
 def fno_profile_instr_generate : Flag<["-"], "fno-profile-instr-generate">,
diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp
index a8b4688aed09c..fcdbe8a6aba5a 100644
--- a/clang/lib/Driver/ToolChains/Flang.cpp
+++ b/clang/lib/Driver/ToolChains/Flang.cpp
@@ -882,6 +882,14 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
   // TODO: Handle interactions between -w, -pedantic, -Wall, -WOption
   Args.AddLastArg(CmdArgs, options::OPT_w);
 
+
+  if (Args.hasArg(options::OPT_fprofile_generate)){ 
+    CmdArgs.push_back("-fprofile-generate");
+  }
+  if (const Arg *A = Args.getLastArg(options::OPT_fprofile_use_EQ)) {
+    CmdArgs.push_back(Args.MakeArgString(std::string("-fprofile-use=") + A->getValue()));
+  }
+
   // Forward flags for OpenMP. We don't do this if the current action is an
   // device offloading action other than OpenMP.
   if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
diff --git a/flang/include/flang/Frontend/CodeGenOptions.def b/flang/include/flang/Frontend/CodeGenOptions.def
index 57830bf51a1b3..4dec86cd8f51b 100644
--- a/flang/include/flang/Frontend/CodeGenOptions.def
+++ b/flang/include/flang/Frontend/CodeGenOptions.def
@@ -24,6 +24,11 @@ CODEGENOPT(OptimizationLevel, 2, 0) ///< The -O[0-3] option specified.
 CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
                                    ///< pass manager.
 
+ENUM_CODEGENOPT(ProfileInstr, ProfileInstrKind, 2, ProfileNone)
+ENUM_CODEGENOPT(ProfileUse, ProfileInstrKind, 2, ProfileNone)
+/// Whether emit extra debug info for sample pgo profile collection.
+CODEGENOPT(DebugInfoForProfiling, 1, 0)
+CODEGENOPT(AtomicProfileUpdate , 1, 0) ///< Set -fprofile-update=atomic
 CODEGENOPT(IsPIE, 1, 0) ///< PIE level is the same as PIC Level.
 CODEGENOPT(PICLevel, 2, 0) ///< PIC level of the LLVM module.
 CODEGENOPT(PrepareForFullLTO , 1, 0) ///< Set when -flto is enabled on the
diff --git a/flang/include/flang/Frontend/CodeGenOptions.h b/flang/include/flang/Frontend/CodeGenOptions.h
index 2b4e823b3fef4..e052250f97e75 100644
--- a/flang/include/flang/Frontend/CodeGenOptions.h
+++ b/flang/include/flang/Frontend/CodeGenOptions.h
@@ -148,6 +148,55 @@ class CodeGenOptions : public CodeGenOptionsBase {
   /// OpenMP is enabled.
   using DoConcurrentMappingKind = flangomp::DoConcurrentMappingKind;
 
+  enum ProfileInstrKind {
+    ProfileNone,       // Profile instrumentation is turned off.
+    ProfileClangInstr, // Clang instrumentation to generate execution counts
+                       // to use with PGO.
+    ProfileIRInstr,    // IR level PGO instrumentation in LLVM.
+    ProfileCSIRInstr, // IR level PGO context sensitive instrumentation in LLVM.
+  };
+
+
+  /// Name of the profile file to use as output for -fprofile-instr-generate,
+  /// -fprofile-generate, and -fcs-profile-generate.
+  std::string InstrProfileOutput;
+
+  /// Name of the profile file to use as input for -fmemory-profile-use.
+  std::string MemoryProfileUsePath;
+
+  unsigned int DebugInfoForProfiling;
+
+  unsigned int AtomicProfileUpdate;
+
+  /// Name of the profile file to use as input for -fprofile-instr-use
+  std::string ProfileInstrumentUsePath;
+
+    /// Name of the profile remapping file to apply to the profile data supplied
+  /// by -fprofile-sample-use or -fprofile-instr-use.
+  std::string ProfileRemappingFile;
+
+  /// Check if Clang profile instrumenation is on.
+  bool hasProfileClangInstr() const {
+    return getProfileInstr() == ProfileClangInstr;
+  }
+
+  /// Check if IR level profile instrumentation is on.
+  bool hasProfileIRInstr() const {
+    return getProfileInstr() == ProfileIRInstr;
+  }
+
+  /// Check if CS IR level profile instrumentation is on.
+  bool hasProfileCSIRInstr() const {
+    return getProfileInstr() == ProfileCSIRInstr;
+  }
+    /// Check if IR level profile use is on.
+    bool hasProfileIRUse() const {
+      return getProfileUse() == ProfileIRInstr ||
+             getProfileUse() == ProfileCSIRInstr;
+    }
+  /// Check if CSIR profile use is on.
+  bool hasProfileCSIRUse() const { return getProfileUse() == ProfileCSIRInstr; }
+
   // Define accessors/mutators for code generation options of enumeration type.
 #define CODEGENOPT(Name, Bits, Default)
 #define ENUM_CODEGENOPT(Name, Type, Bits, Default)                             \
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 6f87a18d69c3d..f013fce2f3cfc 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -27,6 +27,7 @@
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/OptionUtils.h"
 #include "clang/Driver/Options.h"
+#include "clang/Driver/Driver.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Frontend/Debug/Options.h"
@@ -431,6 +432,17 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
       opts.IsPIE = 1;
   }
 
+  if (args.hasArg(clang::driver::options::OPT_fprofile_generate)) {
+    opts.setProfileInstr(Fortran::frontend::CodeGenOptions::ProfileInstrKind::ProfileIRInstr);
+    opts.DebugInfoForProfiling = args.hasArg(clang::driver::options::OPT_fdebug_info_for_profiling);
+    opts.AtomicProfileUpdate = args.hasArg(clang::driver::options::OPT_fprofile_update_EQ);
+  }
+ 
+  if (auto A = args.getLastArg(clang::driver::options::OPT_fprofile_use_EQ)) {
+    opts.setProfileUse(Fortran::frontend::CodeGenOptions::ProfileInstrKind::ProfileIRInstr);
+    opts.ProfileInstrumentUsePath = A->getValue();
+  }
+
   // -mcmodel option.
   if (const llvm::opt::Arg *a =
           args.getLastArg(clang::driver::options::OPT_mcmodel_EQ)) {
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index c1f47b12abee2..68880bdeecf8d 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -63,11 +63,14 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/PGOOptions.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/TargetParser/RISCVISAInfo.h"
 #include "llvm/TargetParser/RISCVTargetParser.h"
 #include "llvm/Transforms/IPO/Internalize.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
+#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
+#include "llvm/ProfileData/InstrProfCorrelator.h"
 #include <memory>
 #include <system_error>
 
@@ -130,6 +133,20 @@ static bool saveMLIRTempFile(const CompilerInvocation &ci,
 // Custom BeginSourceFileAction
 //===----------------------------------------------------------------------===//
 
+
+static llvm::cl::opt<llvm::PGOOptions::ColdFuncOpt> ClPGOColdFuncAttr(
+  "pgo-cold-func-opt", llvm::cl::init(llvm::PGOOptions::ColdFuncOpt::Default), llvm::cl::Hidden,
+  llvm::cl::desc(
+      "Function attribute to apply to cold functions as determined by PGO"),
+    llvm::cl::values(clEnumValN(llvm::PGOOptions::ColdFuncOpt::Default, "default",
+                        "Default (no attribute)"),
+             clEnumValN(llvm::PGOOptions::ColdFuncOpt::OptSize, "optsize",
+                        "Mark cold functions with optsize."),
+             clEnumValN(llvm::PGOOptions::ColdFuncOpt::MinSize, "minsize",
+                        "Mark cold functions with minsize."),
+             clEnumValN(llvm::PGOOptions::ColdFuncOpt::OptNone, "optnone",
+                        "Mark cold functions with optnone.")));
+
 bool PrescanAction::beginSourceFileAction() { return runPrescan(); }
 
 bool PrescanAndParseAction::beginSourceFileAction() {
@@ -892,6 +909,20 @@ static void generateMachineCodeOrAssemblyImpl(clang::DiagnosticsEngine &diags,
   delete tlii;
 }
 
+
+// Default filename used for profile generation.
+namespace llvm {
+  extern llvm::cl::opt<bool> DebugInfoCorrelate;
+  extern llvm::cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate;
+
+
+std::string getDefaultProfileGenName() {
+  return DebugInfoCorrelate || ProfileCorrelate != llvm::InstrProfCorrelator::NONE
+             ? "default_%m.proflite"
+             : "default_%m.profraw";
+}
+}
+
 void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
   CompilerInstance &ci = getInstance();
   const CodeGenOptions &opts = ci.getInvocation().getCodeGenOpts();
@@ -909,6 +940,29 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
   llvm::PassInstrumentationCallbacks pic;
   llvm::PipelineTuningOptions pto;
   std::optional<llvm::PGOOptions> pgoOpt;
+ 
+  if (opts.hasProfileIRInstr()){
+    // // -fprofile-generate.
+    pgoOpt = llvm::PGOOptions(
+      opts.InstrProfileOutput.empty() ? llvm::getDefaultProfileGenName()
+                                             : opts.InstrProfileOutput,
+      "", "", opts.MemoryProfileUsePath, nullptr, llvm::PGOOptions::IRInstr,
+      llvm::PGOOptions::NoCSAction, ClPGOColdFuncAttr,
+      opts.DebugInfoForProfiling,
+      /*PseudoProbeForProfiling=*/false, opts.AtomicProfileUpdate);
+    }
+    else if (opts.hasProfileIRUse()) {
+      llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS = llvm::vfs::getRealFileSystem();
+      // -fprofile-use.
+      auto CSAction = opts.hasProfileCSIRUse() ? llvm::PGOOptions::CSIRUse
+                                                      : llvm::PGOOptions::NoCSAction;
+      pgoOpt = llvm::PGOOptions(opts.ProfileInstrumentUsePath, "",
+        opts.ProfileRemappingFile,
+        opts.MemoryProfileUsePath, VFS,
+                          llvm::PGOOptions::IRUse, CSAction, ClPGOColdFuncAttr,
+                          opts.DebugInfoForProfiling);
+    }
+ 
   llvm::StandardInstrumentations si(llvmModule->getContext(),
                                     opts.DebugPassManager);
   si.registerCallbacks(pic, &mam);
diff --git a/flang/test/Driver/flang-f-opts.f90 b/flang/test/Driver/flang-f-opts.f90
index 4493a519e2010..b972b9b7b2a59 100644
--- a/flang/test/Driver/flang-f-opts.f90
+++ b/flang/test/Driver/flang-f-opts.f90
@@ -8,3 +8,8 @@
 ! CHECK-LABEL: "-fc1"
 ! CHECK: -ffp-contract=off
 ! CHECK: -O3
+
+! RUN: %flang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
+! CHECK-PROFILE-GENERATE-LLVM: "-fprofile-generate"
+! RUN: %flang -### -S -fprofile-use=%S %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-DIR %s
+! CHECK-PROFILE-USE-DIR: "-fprofile-use={{.*}}"
diff --git a/flang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext b/flang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
new file mode 100644
index 0000000000000..6a6df8b1d4d5b
--- /dev/null
+++ b/flang/test/Profile/Inputs/gcc-flag-compatibility_IR.proftext
@@ -0,0 +1,19 @@
+# IR level Instrumentation Flag
+:ir
+_QQmain
+# Func Hash:
+146835646621254984
+# Num Counters:
+2
+# Counter Values:
+100
+1
+
+main
+# Func Hash:
+742261418966908927
+# Num Counters:
+1
+# Counter Values:
+1
+
diff --git a/flang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext b/flang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
new file mode 100644
index 0000000000000..9a46140286673
--- /dev/null
+++ b/flang/test/Profile/Inputs/gcc-flag-compatibility_IR_entry.proftext
@@ -0,0 +1,14 @@
+# IR level Instrumentation Flag
+:ir
+:entry_first
+_QQmain
+# Func Hash:
+146835646621254984
+# Num Counters:
+2
+# Counter Values:
+100
+1
+
+
+
diff --git a/flang/test/Profile/gcc-flag-compatibility.f90 b/flang/test/Profile/gcc-flag-compatibility.f90
new file mode 100644
index 0000000000000..0124bc79b87ef
--- /dev/null
+++ b/flang/test/Profile/gcc-flag-compatibility.f90
@@ -0,0 +1,39 @@
+! Tests for -fprofile-generate and -fprofile-use flag compatibility. These two
+! flags behave similarly to their GCC counterparts:
+!
+! -fprofile-generate         Generates the profile file ./default.profraw
+! -fprofile-use=<dir>/file   Uses the profile file <dir>/file
+
+! On AIX, -flto used to be required with -fprofile-generate. gcc-flag-compatibility-aix.c is used to do the testing on AIX with -flto
+! RUN: %flang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s
+! PROFILE-GEN: @__profc_{{_?}}main = {{(private|internal)}} global [1 x i64] zeroinitializer, section
+! PROFILE-GEN: @__profd_{{_?}}main =
+
+
+
+! Check that -fprofile-use=some/path/file.prof reads some/path/file.prof
+! This uses LLVM IR format profile.
+! RUN: rm -rf %t.dir
+! RUN: mkdir -p %t.dir/some/path
+! RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility_IR.proftext -o %t.dir/some/path/file.prof
+! RUN: %flang %s -o - -emit-llvm -S -fprofile-use=%t.dir/some/path/file.prof | FileCheck -check-prefix=PROFILE-USE-IR1 %s
+!
+
+
+
+! RUN: llvm-profdata merge %S/Inputs/gcc-flag-compatibility_IR_entry.proftext -o %t.dir/some/path/file.prof
+! RUN: %flang %s -o - -emit-llvm -S -fprofile-use=%t.dir/some/path/file.prof | FileCheck -check-prefix=PROFILE-USE-IR2 %s
+! PROFILE-USE-IR1: = !{!"branch_weights", i32 100, i32 1}
+! PROFILE-USE-IR2: = !{!"branch_weights", i32 1, i32 100}
+
+
+program main
+  implicit none
+  integer :: i
+  integer :: X = 0
+
+  do i = 0, 99
+     X = X + i
+  end do
+
+end program main

@fanju110
Copy link
Contributor Author

The following is the Fortran benchmark test data from speccpu2006

Runtime without PGO (Sec) Runtime with PGO (Sec) Speedup
410.bwaves 101 97.6 1.03
416.gamess 259 244 1.06
434.zeusmp 88.8 91 0.98
437.leslie3d 94.7 94.1 1.01
454.calculix 182 180 1.01
459.GemsFDTD 176 187 0.94
465.tonto 118 124 0.95
481.wrf 93.4 91.4 1.02
  • Complier: LLVM 20.1.0

  • Options:

    • without PGO:
      • -O3 -flto -ffast-math
    • with PGO:
      • -O3 -flto -ffast-math -fprofile-generate
      • -O3 -flto -ffast-math -fprofile-use=/file
  • Hardware: 11th Gen Intel(R) Core(TM) i9-11900K @ 3.50GHz

  • OS: Ubuntu20.04.6 LTS (Focal Fossa)

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing this

Comment on lines 886 to 891
if (Args.hasArg(options::OPT_fprofile_generate)){
CmdArgs.push_back("-fprofile-generate");
}
if (const Arg *A = Args.getLastArg(options::OPT_fprofile_use_EQ)) {
CmdArgs.push_back(Args.MakeArgString(std::string("-fprofile-use=") + A->getValue()));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it would be simpler to use

Suggested change
if (Args.hasArg(options::OPT_fprofile_generate)){
CmdArgs.push_back("-fprofile-generate");
}
if (const Arg *A = Args.getLastArg(options::OPT_fprofile_use_EQ)) {
CmdArgs.push_back(Args.MakeArgString(std::string("-fprofile-use=") + A->getValue()));
}
Args.addAllArgs(CmdArgs, {OPT_fprofile_generate, OPT_fprofile_use_EQ});

@tblah tblah requested a review from tarunprabhu April 22, 2025 11:01
Copy link

github-actions bot commented Apr 22, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this.

@@ -148,6 +148,55 @@ class CodeGenOptions : public CodeGenOptionsBase {
/// OpenMP is enabled.
using DoConcurrentMappingKind = flangomp::DoConcurrentMappingKind;

enum ProfileInstrKind {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this enum be shared between clang and flang? There is precedent for doing this, for example with the VectorLibrary enum. That was moved to llvm/include/llvm/Frontend/Driver/CodeGenOptions.h. We could consider doing the same for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would require the definition of this enum variable to be placed in a public namespace. If I do this, I will need to change the source code of clang. Is this appropriate?

extern llvm::cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate;


std::string getDefaultProfileGenName() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a duplicate of the code in I think this function definition could be moved to llvm/lib/Frontend/Driver/CodeGenOptions.cpp or somewhere within llvm/lib/Frontend. There is precedent for doing this with, for example, createTLII. In general, we would like to avoid duplicating code from clang as much as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.

The getDefaultProfileGenName function in the original clang is defined in an anonymous namespace and cannot be directly reused in flang. If I reuse this function, I may need to change the source code of clang, is this appropriate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change the source of clang to move that function to e.g. llvm/lib/Frontend/Driver/CodeGenOptions.cpp and use it from that location from both clang and flang. We've done that in a few different places for options like these (like createTLII as @tarunprabhu mentioned)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change the source of clang to move that function to e.g. llvm/lib/Frontend/Driver/CodeGenOptions.cpp and use it from that location from both clang and flang. We've done that in a few different places for options like these (like createTLII as @tarunprabhu mentioned)

Sorry, I've ported this function to the llvm namespace and forgot to remove the code here, I've now removed this code

# Counter Values:
100
1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the trailing newlines here necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip, I've removed the extra newlines

Remove redundant comment symbols

Co-authored-by: Tom Eccles <[email protected]>
@tarunprabhu
Copy link
Contributor

There is precedent for changing the clang source in order to share code or to augment it for use with flang. For what needs to be done here, I think it should be fine. We will have to request reviews from the clang developers as well.

@fanju110
Copy link
Contributor Author

There is precedent for changing the clang source in order to share code or to augment it for use with flang. For what needs to be done here, I think it should be fine. We will have to request reviews from the clang developers as well.

Since this PR focuses on enabling PGO support in Flang, and changes to the Clang source code may require broader discussion and review, I intend to scope this PR to Flang's features. As you suggested, I've implemented it locally, and I'm going to propose a another PR to make the flang and clang share code

@tarunprabhu
Copy link
Contributor

If I understand what you are saying correctly, this would involve, for example, duplicating the definition of enum ProfileInstrKind in flang in this PR, then a second PR that moves it from both flang and clang to llvm/Frontend. This is churn that can be distracting. The changes to clang in this case are unlikely to be major and getting it reviewed and approved should not be difficult. I would suggest doing those in this PR.

@fanju110
Copy link
Contributor Author

If I understand what you are saying correctly, this would involve, for example, duplicating the definition of enum ProfileInstrKind in flang in this PR, then a second PR that moves it from both flang and clang to llvm/Frontend. This is churn that can be distracting. The changes to clang in this case are unlikely to be major and getting it reviewed and approved should not be difficult. I would suggest doing those in this PR.

Thanks for the advice, I agree with you, I'm currently refining the codes

… definition from clang to the llvm namespace to allow flang to reuse these code.
@llvmbot llvmbot added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen IR generation bugs: mangling, exceptions, etc. labels Apr 28, 2025
Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updating the PR.

There seems to be a buildkite failure. These failures are often worth checking because it might indicate that your changes might be incompatible with a different build configuration from yours.

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates

…gShan/llvm-project into OpenXiangShan/flang-new-add-PGO

# Conflicts:
#	flang/lib/Frontend/FrontendActions.cpp   resolved by OpenXiangShan/flang-new-add-PGO version
#	llvm/include/llvm/Frontend/Driver/CodeGenOptions.h   resolved by OpenXiangShan/flang-new-add-PGO version
#	llvm/lib/Frontend/Driver/CodeGenOptions.cpp   resolved by OpenXiangShan/flang-new-add-PGO version
@fanju110
Copy link
Contributor Author

@MaskRay @aeubanks when you have a moment, could you please take a look at this PR? Let me know if there’s anything I should revise or clarify. Thanks!

@MaskRay @aeubanks

@fanju110
Copy link
Contributor Author

Thank you for seeing this through and making all the little changes. I have requested reviews from @MaskRay and @aeubanks for the clang side of things.

hello,I noticed that this PR has been awaiting clang review for three weeks. I still haven't gotten a comment from them.would it be possible for you to suggest others who might be available to help review? Thanks

@kiranchandramohan
Copy link
Contributor

Thank you for seeing this through and making all the little changes. I have requested reviews from @MaskRay and @aeubanks for the clang side of things.

hello,I noticed that this PR has been awaiting clang review for three weeks. I still haven't gotten a comment from them.would it be possible for you to suggest others who might be available to help review? Thanks

Adding @AaronBallman for reviewing the clang side or to suggest a suitable reviewer.

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang bits LGTM!

Copy link
Contributor

@tarunprabhu tarunprabhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fanju110, Thanks for seeing this through!

@fanju110
Copy link
Contributor Author

@fanju110, Thanks for seeing this through!

Hi @tarunprabhu , If everything looks good, could you please merge this PR at your convenience (I don't have merge rights)? Thank you!

@tarunprabhu
Copy link
Contributor

@fanju110, Thanks for seeing this through!

Hi @tarunprabhu , If everything looks good, could you please merge this PR at your convenience (I don't have merge rights)? Thank you!

It looks like you need to run clang-format on some of the code. See here. For changes that you have made in clang/, please run it only on the code that you have changed and not the entire file. For code in flang/, you may run it on the entire file (in fact, you should)(

@fanju110
Copy link
Contributor Author

@fanju110, Thanks for seeing this through!

Hi @tarunprabhu , If everything looks good, could you please merge this PR at your convenience (I don't have merge rights)? Thank you!

It looks like you need to run clang-format on some of the code. See here. For changes that you have made in clang/, please run it only on the code that you have changed and not the entire file. For code in flang/, you may run it on the entire file (in fact, you should)(

Hi, I have run clang-format as you suggested!

@tarunprabhu tarunprabhu merged commit d27a210 into llvm:main May 30, 2025
11 checks passed
Copy link

@fanju110 Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building clang,flang,llvm at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[4577/7836] Linking CXX executable bin/mlir-irdl-to-cpp
[4578/7836] Linking CXX shared library lib/libMLIRArithDialect.so.21.0git
[4579/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/OpStats.cpp.o
[4580/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/PrintIR.cpp.o
[4581/7836] Linking CXX shared library lib/libMLIRPDLToPDLInterp.so.21.0git
[4582/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/Mem2Reg.cpp.o
[4583/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SCCP.cpp.o
[4584/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[4585/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[4586/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: In function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x3): undefined reference to `llvm::DebugInfoCorrelate'
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x21): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[4587/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/RemoveDeadValues.cpp.o
[4588/7836] Linking CXX shared library lib/libMLIRQueryLib.so.21.0git
[4589/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/StripDebugInfo.cpp.o
[4590/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SymbolDCE.cpp.o
[4591/7836] Creating library symlink lib/libMLIRArithDialect.so
[4592/7836] Creating library symlink lib/libMLIRPDLToPDLInterp.so
[4593/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SROA.cpp.o
[4594/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[4595/7836] Linking CXX shared library lib/libMLIRPluginsLib.so.21.0git
[4596/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/TopologicalSort.cpp.o
[4597/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SymbolPrivatize.cpp.o
[4598/7836] Creating library symlink lib/libLLVMIRPrinter.so
[4599/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[4600/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/ViewOpGraph.cpp.o
[4601/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/ControlFlowSinkUtils.cpp.o
[4602/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/CFGToSCF.cpp.o
[4603/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Module.cpp.o
[4604/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/CommutativityUtils.cpp.o
[4605/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[4606/7836] Linking CXX shared library lib/libMLIRPDLLCodeGen.so.21.0git
[4607/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[4608/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[4609/7836] Building AMDGPUGenAsmWriter.inc...
[4610/7836] Building CXX object tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/LiteralSupport.cpp.o
[4611/7836] Building AMDGPUGenAsmMatcher.inc...
[4612/7836] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4613/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Attributes.cpp.o
[4614/7836] Building AMDGPUGenGlobalISel.inc...
[4615/7836] Building AMDGPUGenDAGISel.inc...
[4616/7836] Building AMDGPUGenInstrInfo.inc...
[4617/7836] Building AMDGPUGenRegisterBank.inc...
[4618/7836] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
In file included from /usr/include/c++/8/cassert:44,
Step 7 (build cmake config) failure: build cmake config (failure)
...
[4577/7836] Linking CXX executable bin/mlir-irdl-to-cpp
[4578/7836] Linking CXX shared library lib/libMLIRArithDialect.so.21.0git
[4579/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/OpStats.cpp.o
[4580/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/PrintIR.cpp.o
[4581/7836] Linking CXX shared library lib/libMLIRPDLToPDLInterp.so.21.0git
[4582/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/Mem2Reg.cpp.o
[4583/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SCCP.cpp.o
[4584/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[4585/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[4586/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: In function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x3): undefined reference to `llvm::DebugInfoCorrelate'
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x21): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[4587/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/RemoveDeadValues.cpp.o
[4588/7836] Linking CXX shared library lib/libMLIRQueryLib.so.21.0git
[4589/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/StripDebugInfo.cpp.o
[4590/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SymbolDCE.cpp.o
[4591/7836] Creating library symlink lib/libMLIRArithDialect.so
[4592/7836] Creating library symlink lib/libMLIRPDLToPDLInterp.so
[4593/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SROA.cpp.o
[4594/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[4595/7836] Linking CXX shared library lib/libMLIRPluginsLib.so.21.0git
[4596/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/TopologicalSort.cpp.o
[4597/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/SymbolPrivatize.cpp.o
[4598/7836] Creating library symlink lib/libLLVMIRPrinter.so
[4599/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[4600/7836] Building CXX object tools/mlir/lib/Transforms/CMakeFiles/obj.MLIRTransforms.dir/ViewOpGraph.cpp.o
[4601/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/ControlFlowSinkUtils.cpp.o
[4602/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/CFGToSCF.cpp.o
[4603/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Module.cpp.o
[4604/7836] Building CXX object tools/mlir/lib/Transforms/Utils/CMakeFiles/obj.MLIRTransformUtils.dir/CommutativityUtils.cpp.o
[4605/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[4606/7836] Linking CXX shared library lib/libMLIRPDLLCodeGen.so.21.0git
[4607/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[4608/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[4609/7836] Building AMDGPUGenAsmWriter.inc...
[4610/7836] Building CXX object tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/LiteralSupport.cpp.o
[4611/7836] Building AMDGPUGenAsmMatcher.inc...
[4612/7836] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4613/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Attributes.cpp.o
[4614/7836] Building AMDGPUGenGlobalISel.inc...
[4615/7836] Building AMDGPUGenDAGISel.inc...
[4616/7836] Building AMDGPUGenInstrInfo.inc...
[4617/7836] Building AMDGPUGenRegisterBank.inc...
[4618/7836] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
In file included from /usr/include/c++/8/cassert:44,

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building clang,flang,llvm at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[5073/7836] Creating library symlink lib/libLLVMAnalysis.so
[5074/7836] Linking CXX shared library lib/libMLIRTosaToArith.so.21.0git
[5075/7836] Linking CXX shared library lib/libMLIRTosaToSCF.so.21.0git
[5076/7836] Linking CXX shared library lib/libMLIRTosaToMLProgram.so.21.0git
[5077/7836] Linking CXX shared library lib/libMLIRLinalgDialect.so.21.0git
[5078/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[5079/7836] Creating library symlink lib/libLLVMIRPrinter.so
[5080/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[5081/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[5082/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: in function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x3): undefined reference to `llvm::DebugInfoCorrelate'
/usr/bin/ld: CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x21): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[5083/7836] Linking CXX shared library lib/libMLIRTosaToTensor.so.21.0git
[5084/7836] Linking CXX shared library lib/libMLIRMemRefTransforms.so.21.0git
[5085/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[5086/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[5087/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[5088/7836] Building AMDGPUGenCallingConv.inc...
[5089/7836] Linking CXX shared library lib/libMLIRSPIRVDialect.so.21.0git
[5090/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[5091/7836] Building AMDGPUGenSearchableTables.inc...
[5092/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/CodeGenOptions.cpp.o
[5093/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o
[5094/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/ARC.cpp.o
[5095/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenCLOptions.cpp.o
[5096/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/ProfileList.cpp.o
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/lib/Basic/ProfileList.cpp: In function ‘llvm::StringRef getSectionName(llvm::driver::ProfileInstrKind)’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/lib/Basic/ProfileList.cpp:83:3: warning: case value ‘4’ not in enumerated type ‘llvm::driver::ProfileInstrKind’ [-Wswitch]
   83 |   case CodeGenOptions::ProfileIRSampleColdCov:
      |   ^~~~
[5097/7836] Building AMDGPUGenAsmWriter.inc...
[5098/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/TargetInfo.cpp.o
[5099/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/AMDGPU.cpp.o
[5100/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Module.cpp.o
[5101/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/ARM.cpp.o
[5102/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/AArch64.cpp.o
[5103/7836] Building AMDGPUGenGlobalISel.inc...
[5104/7836] Building AMDGPUGenDAGISel.inc...
[5105/7836] Building AMDGPUGenAsmMatcher.inc...
[5106/7836] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5107/7836] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteModernObjC.cpp.o
[5108/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Attributes.cpp.o
[5109/7836] Building AMDGPUGenRegisterBank.inc...
[5110/7836] Building AMDGPUGenInstrInfo.inc...
[5111/7836] Building AMDGPUGenRegisterInfo.inc...
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5073/7836] Creating library symlink lib/libLLVMAnalysis.so
[5074/7836] Linking CXX shared library lib/libMLIRTosaToArith.so.21.0git
[5075/7836] Linking CXX shared library lib/libMLIRTosaToSCF.so.21.0git
[5076/7836] Linking CXX shared library lib/libMLIRTosaToMLProgram.so.21.0git
[5077/7836] Linking CXX shared library lib/libMLIRLinalgDialect.so.21.0git
[5078/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[5079/7836] Creating library symlink lib/libLLVMIRPrinter.so
[5080/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[5081/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[5082/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: in function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x3): undefined reference to `llvm::DebugInfoCorrelate'
/usr/bin/ld: CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x21): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[5083/7836] Linking CXX shared library lib/libMLIRTosaToTensor.so.21.0git
[5084/7836] Linking CXX shared library lib/libMLIRMemRefTransforms.so.21.0git
[5085/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[5086/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[5087/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[5088/7836] Building AMDGPUGenCallingConv.inc...
[5089/7836] Linking CXX shared library lib/libMLIRSPIRVDialect.so.21.0git
[5090/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[5091/7836] Building AMDGPUGenSearchableTables.inc...
[5092/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/CodeGenOptions.cpp.o
[5093/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o
[5094/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/ARC.cpp.o
[5095/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/OpenCLOptions.cpp.o
[5096/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/ProfileList.cpp.o
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/lib/Basic/ProfileList.cpp: In function ‘llvm::StringRef getSectionName(llvm::driver::ProfileInstrKind)’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/clang/lib/Basic/ProfileList.cpp:83:3: warning: case value ‘4’ not in enumerated type ‘llvm::driver::ProfileInstrKind’ [-Wswitch]
   83 |   case CodeGenOptions::ProfileIRSampleColdCov:
      |   ^~~~
[5097/7836] Building AMDGPUGenAsmWriter.inc...
[5098/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/TargetInfo.cpp.o
[5099/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/AMDGPU.cpp.o
[5100/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Module.cpp.o
[5101/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/ARM.cpp.o
[5102/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/AArch64.cpp.o
[5103/7836] Building AMDGPUGenGlobalISel.inc...
[5104/7836] Building AMDGPUGenDAGISel.inc...
[5105/7836] Building AMDGPUGenAsmMatcher.inc...
[5106/7836] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5107/7836] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteModernObjC.cpp.o
[5108/7836] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Attributes.cpp.o
[5109/7836] Building AMDGPUGenRegisterBank.inc...
[5110/7836] Building AMDGPUGenInstrInfo.inc...
[5111/7836] Building AMDGPUGenRegisterInfo.inc...

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building clang,flang,llvm at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[4788/7836] Linking CXX shared library lib/libMLIRNVGPUDialect.so.21.0git
[4789/7836] Linking CXX shared library lib/libMLIRShardingInterface.so.21.0git
[4790/7836] Linking CXX shared library lib/libMLIRArithToEmitC.so.21.0git
[4791/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[4792/7836] Linking CXX shared library lib/libMLIRBufferizationDialect.so.21.0git
[4793/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[4794/7836] Creating library symlink lib/libMLIRArithToEmitC.so
[4795/7836] Creating library symlink lib/libLLVMIRPrinter.so
[4796/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[4797/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: in function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x7): undefined reference to `llvm::DebugInfoCorrelate'
/usr/bin/ld: CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x25): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[4798/7836] Creating library symlink lib/libMLIRTensorUtils.so
[4799/7836] Creating library symlink lib/libMLIRBufferizationDialect.so
[4800/7836] Creating library symlink lib/libMLIRShardingInterface.so
[4801/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[4802/7836] Linking CXX shared library lib/libMLIRSCFDialect.so.21.0git
[4803/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[4804/7836] Building CXX object tools/mlir/test/lib/Dialect/TestIRDLToCpp/CMakeFiles/MLIRTestIRDLToCppDialect.dir/TestIRDLToCppDialect.cpp.o
In file included from /usr/include/c++/11/cassert:44,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/IR/ProfileSummary.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/IR/Module.h:30,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h:38,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h:16,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/test/lib/Dialect/TestIRDLToCpp/TestIRDLToCppDialect.cpp:22:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/test/lib/Dialect/TestIRDLToCpp/test_irdl_to_cpp.irdl.mlir.cpp.inc: In static member function ‘static llvm::StringRef mlir::test_irdl_to_cpp::BarOp::getOperandName(unsigned int)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/test/lib/Dialect/TestIRDLToCpp/test_irdl_to_cpp.irdl.mlir.cpp.inc:223:18: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  223 |     assert(index < 0 && "invalid attribute index");
      |            ~~~~~~^~~
[4805/7836] Linking CXX shared library lib/libMLIRShapeDialect.so.21.0git
[4806/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[4807/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[4808/7836] Building AMDGPUGenPostLegalizeGICombiner.inc...
[4809/7836] Building CXX object tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/LiteralSupport.cpp.o
[4810/7836] Building AMDGPUGenDisassemblerTables.inc...
[4811/7836] Building AMDGPUGenRegBankGICombiner.inc...
[4812/7836] Building AMDGPUGenPreLegalizeGICombiner.inc...
[4813/7836] Building AMDGPUGenMCCodeEmitter.inc...
[4814/7836] Linking CXX shared library lib/libMLIRSPIRVDialect.so.21.0git
[4815/7836] Building AMDGPUGenSubtargetInfo.inc...
[4816/7836] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteModernObjC.cpp.o
[4817/7836] Building AMDGPUGenSearchableTables.inc...
[4818/7836] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/DeviceOffload.cpp.o
[4819/7836] Building AMDGPUGenCallingConv.inc...
[4820/7836] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/GuessTargetAndModeCompilationDatabase.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[4788/7836] Linking CXX shared library lib/libMLIRNVGPUDialect.so.21.0git
[4789/7836] Linking CXX shared library lib/libMLIRShardingInterface.so.21.0git
[4790/7836] Linking CXX shared library lib/libMLIRArithToEmitC.so.21.0git
[4791/7836] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
[4792/7836] Linking CXX shared library lib/libMLIRBufferizationDialect.so.21.0git
[4793/7836] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
[4794/7836] Creating library symlink lib/libMLIRArithToEmitC.so
[4795/7836] Creating library symlink lib/libLLVMIRPrinter.so
[4796/7836] Creating library symlink lib/libLLVMFrontendAtomic.so
[4797/7836] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: in function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x7): undefined reference to `llvm::DebugInfoCorrelate'
/usr/bin/ld: CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x25): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
[4798/7836] Creating library symlink lib/libMLIRTensorUtils.so
[4799/7836] Creating library symlink lib/libMLIRBufferizationDialect.so
[4800/7836] Creating library symlink lib/libMLIRShardingInterface.so
[4801/7836] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
[4802/7836] Linking CXX shared library lib/libMLIRSCFDialect.so.21.0git
[4803/7836] Linking CXX shared library lib/libLLVMTarget.so.21.0git
[4804/7836] Building CXX object tools/mlir/test/lib/Dialect/TestIRDLToCpp/CMakeFiles/MLIRTestIRDLToCppDialect.dir/TestIRDLToCppDialect.cpp.o
In file included from /usr/include/c++/11/cassert:44,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/IR/ProfileSummary.h:17,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include/llvm/IR/Module.h:30,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h:38,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h:16,
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/test/lib/Dialect/TestIRDLToCpp/TestIRDLToCppDialect.cpp:22:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/test/lib/Dialect/TestIRDLToCpp/test_irdl_to_cpp.irdl.mlir.cpp.inc: In static member function ‘static llvm::StringRef mlir::test_irdl_to_cpp::BarOp::getOperandName(unsigned int)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/tools/mlir/test/lib/Dialect/TestIRDLToCpp/test_irdl_to_cpp.irdl.mlir.cpp.inc:223:18: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits]
  223 |     assert(index < 0 && "invalid attribute index");
      |            ~~~~~~^~~
[4805/7836] Linking CXX shared library lib/libMLIRShapeDialect.so.21.0git
[4806/7836] Linking CXX shared library lib/libLLVMSandboxIR.so.21.0git
[4807/7836] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
[4808/7836] Building AMDGPUGenPostLegalizeGICombiner.inc...
[4809/7836] Building CXX object tools/clang/lib/Lex/CMakeFiles/obj.clangLex.dir/LiteralSupport.cpp.o
[4810/7836] Building AMDGPUGenDisassemblerTables.inc...
[4811/7836] Building AMDGPUGenRegBankGICombiner.inc...
[4812/7836] Building AMDGPUGenPreLegalizeGICombiner.inc...
[4813/7836] Building AMDGPUGenMCCodeEmitter.inc...
[4814/7836] Linking CXX shared library lib/libMLIRSPIRVDialect.so.21.0git
[4815/7836] Building AMDGPUGenSubtargetInfo.inc...
[4816/7836] Building CXX object tools/clang/lib/Frontend/Rewrite/CMakeFiles/obj.clangRewriteFrontend.dir/RewriteModernObjC.cpp.o
[4817/7836] Building AMDGPUGenSearchableTables.inc...
[4818/7836] Building CXX object tools/clang/lib/Interpreter/CMakeFiles/obj.clangInterpreter.dir/DeviceOffload.cpp.o
[4819/7836] Building AMDGPUGenCallingConv.inc...
[4820/7836] Building CXX object tools/clang/lib/Tooling/CMakeFiles/obj.clangTooling.dir/GuessTargetAndModeCompilationDatabase.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang,flang,llvm at step 5 "compile-openmp".

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

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
9.419 [1581/64/3007] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseObjc.cpp.o
9.433 [1580/64/3008] Linking CXX shared library lib/libLLVMIRPrinter.so.21.0git
9.443 [1579/64/3009] Creating library symlink lib/libLLVMIRPrinter.so
9.477 [1578/64/3010] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
9.478 [1577/64/3011] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets/X86.cpp.o
9.502 [1576/64/3012] Linking CXX shared library lib/libLLVMFrontendAtomic.so.21.0git
9.510 [1575/64/3013] Linking CXX shared library lib/libLLVMBitWriter.so.21.0git
9.512 [1574/64/3014] Creating library symlink lib/libLLVMFrontendAtomic.so
9.520 [1573/64/3015] Creating library symlink lib/libLLVMBitWriter.so
9.538 [1572/64/3016] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/lib && :
/usr/bin/ld: lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o: in function `llvm::driver::getDefaultProfileGenName[abi:cxx11]()':
CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x7): undefined reference to `llvm::DebugInfoCorrelate'
/usr/bin/ld: CodeGenOptions.cpp:(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x25): undefined reference to `llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
9.544 [1572/63/3017] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaAttr.cpp.o
9.583 [1572/62/3018] Linking CXX shared library lib/libLLVMCGData.so.21.0git
9.586 [1572/61/3019] Linking CXX shared library lib/libLLVMTarget.so.21.0git
9.694 [1572/60/3020] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCast.cpp.o
9.700 [1572/59/3021] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
9.848 [1572/58/3022] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/FormatString.cpp.o
9.969 [1572/57/3023] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaARM.cpp.o
9.989 [1572/56/3024] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParsePragma.cpp.o
9.993 [1572/55/3025] Building AMDGPUGenMCPseudoLowering.inc...
10.129 [1572/54/3026] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDeclCXX.cpp.o
10.429 [1572/53/3027] Building AMDGPUGenPreLegalizeGICombiner.inc...
10.455 [1572/52/3028] Building AMDGPUGenRegBankGICombiner.inc...
10.775 [1572/51/3029] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseOpenMP.cpp.o
10.801 [1572/50/3030] Building AMDGPUGenPostLegalizeGICombiner.inc...
10.832 [1572/49/3031] Building AMDGPUGenMCCodeEmitter.inc...
10.963 [1572/48/3032] Building CXX object tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Targets.cpp.o
11.041 [1572/47/3033] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ScanfFormatString.cpp.o
11.044 [1572/46/3034] Building AMDGPUGenSubtargetInfo.inc...
11.077 [1572/45/3035] Building AMDGPUGenDisassemblerTables.inc...
11.111 [1572/44/3036] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/PrintfFormatString.cpp.o
11.182 [1572/43/3037] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/ParsedAttr.cpp.o
11.220 [1572/42/3038] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/ABIInfoImpl.cpp.o
11.478 [1572/41/3039] Building CXX object tools/clang/lib/Parse/CMakeFiles/obj.clangParse.dir/ParseDecl.cpp.o
11.514 [1572/40/3040] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/RecordLayout.cpp.o
11.719 [1572/39/3041] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclObjC.cpp.o
11.809 [1572/38/3042] Building AMDGPUGenSearchableTables.inc...
11.988 [1572/37/3043] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ItaniumCXXABI.cpp.o
12.064 [1572/36/3044] Building AMDGPUGenCallingConv.inc...
12.092 [1572/35/3045] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ByteCode/InterpBuiltinBitCast.cpp.o
12.209 [1572/34/3046] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/MicrosoftCXXABI.cpp.o
12.377 [1572/33/3047] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
12.635 [1572/32/3048] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/Mangle.cpp.o
12.712 [1572/31/3049] Building CXX object tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/DeclBase.cpp.o

@tarunprabhu
Copy link
Contributor

@fanju110

The PR caused some buildbot failures, so I have reverted it. You can see the error here.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 30, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building clang,flang,llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
In file included from /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/tools/llvm-link/llvm-link.cpp:36:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  273 |     ImportListsTy() : EmptyList(ImportIDs) {}
      |                                 ^~~~~~~~~
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
      |                                            ^~~~~~~~~
45.744 [637/11/2102] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold   -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/lib && :
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o:CodeGenOptions.cpp:function llvm::driver::getDefaultProfileGenName[abi:cxx11]():(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x7): error: undefined reference to 'llvm::DebugInfoCorrelate'
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o:CodeGenOptions.cpp:function llvm::driver::getDefaultProfileGenName[abi:cxx11]():(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x1e): error: undefined reference to 'llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
45.949 [637/4/2109] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
53.427 [637/2/2111] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
In file included from /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/LTO/LTO.h:32,
                 from /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/lib/LTO/LTO.cpp:13:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  273 |     ImportListsTy() : EmptyList(ImportIDs) {}
      |                                 ^~~~~~~~~
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
      |                                            ^~~~~~~~~
54.081 [637/1/2112] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented May 30, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building clang,flang,llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
In file included from /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/tools/llvm-link/llvm-link.cpp:36:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  273 |     ImportListsTy() : EmptyList(ImportIDs) {}
      |                                 ^~~~~~~~~
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
      |                                            ^~~~~~~~~
45.902 [639/11/2100] Linking CXX shared library lib/libLLVMFrontendDriver.so.21.0git
FAILED: lib/libLLVMFrontendDriver.so.21.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=gold   -Wl,--gc-sections -shared -Wl,-soname,libLLVMFrontendDriver.so.21.0git -o lib/libLLVMFrontendDriver.so.21.0git lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/lib:"  lib/libLLVMAnalysis.so.21.0git  lib/libLLVMCore.so.21.0git  lib/libLLVMSupport.so.21.0git  -Wl,-rpath-link,/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/lib && :
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o:CodeGenOptions.cpp:function llvm::driver::getDefaultProfileGenName[abi:cxx11]():(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x7): error: undefined reference to 'llvm::DebugInfoCorrelate'
lib/Frontend/Driver/CMakeFiles/LLVMFrontendDriver.dir/CodeGenOptions.cpp.o:CodeGenOptions.cpp:function llvm::driver::getDefaultProfileGenName[abi:cxx11]():(.text._ZN4llvm6driver24getDefaultProfileGenNameB5cxx11Ev+0x1e): error: undefined reference to 'llvm::ProfileCorrelate'
collect2: error: ld returned 1 exit status
46.104 [639/4/2107] Linking CXX shared library lib/libLLVMTransformUtils.so.21.0git
50.893 [639/2/2109] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
53.468 [639/1/2110] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
In file included from /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/LTO/LTO.h:32,
                 from /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/lib/LTO/LTO.cpp:13:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy()’:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:273:33: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  273 |     ImportListsTy() : EmptyList(ImportIDs) {}
      |                                 ^~~~~~~~~
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h: In constructor ‘llvm::FunctionImporter::ImportListsTy::ImportListsTy(size_t)’:
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/include/llvm/Transforms/IPO/FunctionImport.h:274:44: warning: member ‘llvm::FunctionImporter::ImportListsTy::ImportIDs’ is used uninitialized [-Wuninitialized]
  274 |     ImportListsTy(size_t Size) : EmptyList(ImportIDs), ListsImpl(Size) {}
      |                                            ^~~~~~~~~
ninja: build stopped: subcommand failed.

@fanju110
Copy link
Contributor Author

@fanju110

The PR caused some buildbot failures, so I have reverted it. You can see the error here.

I'm very sorry for this trouble.I'll check carefully and fix it before submitting again.

@tarunprabhu
Copy link
Contributor

I'm very sorry for this trouble.I'll check carefully and fix it before submitting again.

Happens to all of us. As a reviewer, I should have spotted this before approving it. Let's both try to get it right the second time around :-)

tarunprabhu added a commit that referenced this pull request Jun 13, 2025
This PR resubmits the changes from #136098, which was previously
reverted due to a build failure during the linking stage:

```
undefined reference to `llvm::DebugInfoCorrelate'  
undefined reference to `llvm::ProfileCorrelate'
```

The root cause was that `llvm/lib/Frontend/Driver/CodeGenOptions.cpp`
references symbols from the `Instrumentation` component, but the
`LINK_COMPONENTS` in the `llvm/lib/Frontend/CMakeLists.txt` for
`LLVMFrontendDriver` did not include it. As a result, linking failed in
configurations where these components were not transitively linked.

### Fix:

This updated patch explicitly adds `Instrumentation` to
`LINK_COMPONENTS` in the relevant `llvm/lib/Frontend/CMakeLists.txt`
file to ensure the required symbols are properly resolved.

---------

Co-authored-by: ict-ql <[email protected]>
Co-authored-by: Chyaka <[email protected]>
Co-authored-by: Tarun Prabhu <[email protected]>
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
This PR resubmits the changes from llvm#136098, which was previously
reverted due to a build failure during the linking stage:

```
undefined reference to `llvm::DebugInfoCorrelate'  
undefined reference to `llvm::ProfileCorrelate'
```

The root cause was that `llvm/lib/Frontend/Driver/CodeGenOptions.cpp`
references symbols from the `Instrumentation` component, but the
`LINK_COMPONENTS` in the `llvm/lib/Frontend/CMakeLists.txt` for
`LLVMFrontendDriver` did not include it. As a result, linking failed in
configurations where these components were not transitively linked.

### Fix:

This updated patch explicitly adds `Instrumentation` to
`LINK_COMPONENTS` in the relevant `llvm/lib/Frontend/CMakeLists.txt`
file to ensure the required symbols are properly resolved.

---------

Co-authored-by: ict-ql <[email protected]>
Co-authored-by: Chyaka <[email protected]>
Co-authored-by: Tarun Prabhu <[email protected]>
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
This PR resubmits the changes from llvm#136098, which was previously
reverted due to a build failure during the linking stage:

```
undefined reference to `llvm::DebugInfoCorrelate'  
undefined reference to `llvm::ProfileCorrelate'
```

The root cause was that `llvm/lib/Frontend/Driver/CodeGenOptions.cpp`
references symbols from the `Instrumentation` component, but the
`LINK_COMPONENTS` in the `llvm/lib/Frontend/CMakeLists.txt` for
`LLVMFrontendDriver` did not include it. As a result, linking failed in
configurations where these components were not transitively linked.

### Fix:

This updated patch explicitly adds `Instrumentation` to
`LINK_COMPONENTS` in the relevant `llvm/lib/Frontend/CMakeLists.txt`
file to ensure the required symbols are properly resolved.

---------

Co-authored-by: ict-ql <[email protected]>
Co-authored-by: Chyaka <[email protected]>
Co-authored-by: Tarun Prabhu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc. clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category flang:driver flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Profile-Guided Optimization (PGO) support to the Flang compiler
9 participants