llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Henry Jiang (mustartt)

<details>
<summary>Changes</summary>

Currently, `dsymutil` is not called when passing `-fpseudo-probe-for-profiling` 
or `-debug-info-for-profiling`. When either flags is present, we should 
externalize these content into the `.dSYM` bundle.

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


2 Files Affected:

- (modified) clang/lib/Driver/Driver.cpp (+8-1) 
- (modified) clang/test/Driver/pseudo-probe.c (+12) 


``````````diff
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index b7f65b7b74401..cc050152f5fa9 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -2913,7 +2913,14 @@ void Driver::BuildUniversalActions(Compilation &C, const 
ToolChain &TC,
     Arg *A = Args.getLastArg(options::OPT_g_Group);
     bool enablesDebugInfo = A && !A->getOption().matches(options::OPT_g0) &&
                             !A->getOption().matches(options::OPT_gstabs);
-    if ((enablesDebugInfo || willEmitRemarks(Args)) &&
+    bool enablesPseudoProbe =
+        Args.hasFlag(options::OPT_fpseudo_probe_for_profiling,
+                     options::OPT_fno_pseudo_probe_for_profiling, false);
+    bool enablesDebugInfoForProfiling =
+        Args.hasFlag(options::OPT_fdebug_info_for_profiling,
+                     options::OPT_fno_debug_info_for_profiling, false);
+    if ((enablesDebugInfo || willEmitRemarks(Args) || enablesPseudoProbe ||
+         enablesDebugInfoForProfiling) &&
         ContainsCompileOrAssembleAction(Actions.back())) {
 
       // Add a 'dsymutil' step if necessary, when debug info is enabled and we
diff --git a/clang/test/Driver/pseudo-probe.c b/clang/test/Driver/pseudo-probe.c
index 76c4364e609d0..b0fe271443b1b 100644
--- a/clang/test/Driver/pseudo-probe.c
+++ b/clang/test/Driver/pseudo-probe.c
@@ -11,3 +11,15 @@
 // NOPROBE-NOT: -funique-internal-linkage-names
 // NONAME: -fpseudo-probe-for-profiling
 // NONAME-NOT: -funique-internal-linkage-names
+
+// On Darwin, -fpseudo-probe-for-profiling should trigger dsymutil
+// RUN: %clang -target x86_64-apple-darwin10 -### -o foo 
-fpseudo-probe-for-profiling %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-DSYMUTIL-PSEUDO-PROBE
+// CHECK-DSYMUTIL-PSEUDO-PROBE: "-cc1"
+// CHECK-DSYMUTIL-PSEUDO-PROBE: ld
+// CHECK-DSYMUTIL-PSEUDO-PROBE: dsymutil
+
+// On Darwin, -fdebug-info-for-profiling should trigger dsymutil
+// RUN: %clang -target x86_64-apple-darwin10 -### -o foo 
-fdebug-info-for-profiling %s 2>&1 | FileCheck %s 
--check-prefix=CHECK-DSYMUTIL-DEBUG-PROF
+// CHECK-DSYMUTIL-DEBUG-PROF: "-cc1"
+// CHECK-DSYMUTIL-DEBUG-PROF: ld
+// CHECK-DSYMUTIL-DEBUG-PROF: dsymutil

``````````

</details>


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

Reply via email to