[clang] Propagate -ftime-report to offload lto (#122143)

This commit is contained in:
macurtis-amd 2025-01-08 14:50:38 -06:00 committed by GitHub
parent 676c641718
commit f35b9ad99f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 0 deletions

View File

@ -9282,6 +9282,10 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
if (const Arg *A = Args.getLastArg(options::OPT_Rpass_analysis_EQ)) if (const Arg *A = Args.getLastArg(options::OPT_Rpass_analysis_EQ))
CmdArgs.push_back(Args.MakeArgString( CmdArgs.push_back(Args.MakeArgString(
Twine("--offload-opt=-pass-remarks-analysis=") + A->getValue())); Twine("--offload-opt=-pass-remarks-analysis=") + A->getValue()));
if (Args.getLastArg(options::OPT_ftime_report))
CmdArgs.push_back("--device-compiler=-ftime-report");
if (Args.getLastArg(options::OPT_save_temps_EQ)) if (Args.getLastArg(options::OPT_save_temps_EQ))
CmdArgs.push_back("--save-temps"); CmdArgs.push_back("--save-temps");

View File

@ -1209,6 +1209,10 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
if (ImplicitMapSyms) if (ImplicitMapSyms)
CmdArgs.push_back( CmdArgs.push_back(
Args.MakeArgString(Twine(PluginOptPrefix) + "-implicit-mapsyms")); Args.MakeArgString(Twine(PluginOptPrefix) + "-implicit-mapsyms"));
if (Args.hasArg(options::OPT_ftime_report))
CmdArgs.push_back(
Args.MakeArgString(Twine(PluginOptPrefix) + "-time-passes"));
} }
void tools::addOpenMPRuntimeLibraryPath(const ToolChain &TC, void tools::addOpenMPRuntimeLibraryPath(const ToolChain &TC,

View File

@ -81,3 +81,7 @@
// RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp --offload-arch=gfx803 \ // RUN: %clang -### --target=x86_64-unknown-linux-gnu -emit-llvm -S -fopenmp --offload-arch=gfx803 \
// RUN: -stdlib=libc++ -nogpulib %s 2>&1 | FileCheck %s --check-prefix=LIBCXX // RUN: -stdlib=libc++ -nogpulib %s 2>&1 | FileCheck %s --check-prefix=LIBCXX
// LIBCXX-NOT: include/amdgcn-amd-amdhsa/c++/v1 // LIBCXX-NOT: include/amdgcn-amd-amdhsa/c++/v1
// RUN: %clang -### -target x86_64-pc-linux-gnu -nogpulib -fopenmp --offload-arch=gfx90a \
// RUN: -ftime-report %s 2>&1 | FileCheck %s --check-prefix=CHECK-TIME-REPORT
// CHECK-TIME-REPORT: clang-linker-wrapper{{.*}}"--device-compiler=-ftime-report"

View File

@ -114,3 +114,9 @@
// //
// CHECK-GISEL: "-plugin-opt=-global-isel=1" // CHECK-GISEL: "-plugin-opt=-global-isel=1"
// CHECK-DISABLE-GISEL: "-plugin-opt=-global-isel=0" // CHECK-DISABLE-GISEL: "-plugin-opt=-global-isel=0"
// -flto passes -time-passes when -ftime-report is passed
// RUN: %clang --target=x86_64-unknown-linux-gnu -### %s -flto -ftime-report 2> %t
// RUN: FileCheck --check-prefix=CHECK-TIME-REPORT < %t %s
// CHECK-TIME-REPORT: "-plugin-opt=-time-passes"