================
@@ -6182,6 +6182,42 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
     }
   }
 
+  if (Arg *A =
+          Args.getLastArg(options::OPT_fpartition_static_data_sections,
+                          options::OPT_fno_partition_static_data_sections)) {
+    if (!A->getOption().matches(
+            options::OPT_fno_partition_static_data_sections)) {
+      // This codegen pass is only available on x86 and AArch64 ELF targets.
+      if ((Triple.isX86() || Triple.isAArch64()) && Triple.isOSBinFormatELF()) 
{
+        A->render(Args, CmdArgs);
+        // Turn on -memprof-annotate-static-data-prefix.
----------------
mingmingl-llvm wrote:

> I think the details here are important for userx but hard to discover. We 
> need to add documentation to 
> https://clang.llvm.org/docs/ClangCommandLineReference.html for this flag too. 
> I suggest we drop the comments here and document the usage in the command 
> line reference. What do you think?

I agree we can add documentation to clang command line reference and memprof 
docs; I'm slightly leaning towards keeping the details to memprof docs compared 
with ClangCommandLineReference.html but we can figure out that in a separate 
change. For now removed the detailed comments from 
'clang/lib/Driver/ToolChains/Clang.cpp'  

> It seems to assume that -fprofile-use is a given.

Yeah, agree it'd be good to call out this assumption in the doc.
> The last sentence "... this LLVM flag is a no-op" is inconsistent with the 
> second bullet since it will draw the counts from the PGO profile

The comment means to say the llvm flag 'memprof-annotate-static-data-prefix' is 
no-op when -fmemory-profile-use is not specified (i.e., memory profile is not 
provided); the second point above is for cases the llvm flag is provided and 
does assume PGO counters are available as you pointed above. It's a bit unclear 
to me why they are inconsistent but we can discuss more when the comments are 
added to the doc.

https://github.com/llvm/llvm-project/pull/124991
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to