[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2017-01-03 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment.

ping...

Thanks,
Dehao


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-15 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 81609.
danielcdh added a comment.

update option name


https://reviews.llvm.org/D25435

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/clang_f_opts.c


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -469,3 +469,8 @@
 // CHECK-WCHAR2: -fshort-wchar
 // CHECK-WCHAR2-NOT: -fno-short-wchar
 // DELIMITERS: {{^ *"}}
+
+// RUN: %clang -### -S -fno-debug-info-for-profiling 
-fdebug-info-for-profiling %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DEBUG %s
+// RUN: %clang -### -S -fdebug-info-for-profiling 
-fno-debug-info-for-profiling %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-PROFILE-DEBUG %s
+// CHECK-PROFILE-DEBUG: -fdebug-info-for-profiling
+// CHECK-NO-PROFILE-DEBUG-NOT: -fdebug-info-for-profiling
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -538,6 +538,8 @@
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
   Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
   Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
+  Opts.DebugInfoForProfiling = Args.hasFlag(
+  OPT_fdebug_info_for_profiling, OPT_fno_debug_info_for_profiling, false);
 
   setPGOInstrumentor(Opts, Args, Diags);
   Opts.InstrProfileOutput =
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5565,6 +5565,10 @@
   A->render(Args, CmdArgs);
   }
 
+  if (Args.hasFlag(options::OPT_fdebug_info_for_profiling,
+   options::OPT_fno_debug_info_for_profiling, false))
+CmdArgs.push_back("-fdebug-info-for-profiling");
+
   // -fbuiltin is default unless -mkernel is used.
   bool UseBuiltins =
   Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2741,9 +2741,10 @@
   }
   // No need to replicate the linkage name if it isn't different from the
   // subprogram name, no need to have it at all unless coverage is enabled or
-  // debug is set to more than just line tables.
+  // debug is set to more than just line tables or extra debug info is needed.
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().DebugInfoForProfiling &&
   DebugKind <= 
codegenoptions::DebugLineTablesOnly))
 LinkageName = StringRef();
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -575,6 +575,7 @@
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
   Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations;
+  Options.DebugInfoForProfiling = CodeGenOpts.DebugInfoForProfiling;
 
   // Set EABI version.
   Options.EABIVersion = llvm::StringSwitch(TargetOpts.EABIVersion)
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -255,6 +255,9 @@
 /// Whether copy relocations support is available when building as PIE.
 CODEGENOPT(PIECopyRelocations, 1, 0)
 
+/// Whether emit extra debug info for sample pgo profile collection.
+CODEGENOPT(DebugInfoForProfiling, 1, 0)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -514,6 +514,12 @@
 HelpText<"Enable sample-based profile guided optimizations">;
 def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,
 Alias;
+def fdebug_info_for_profiling : Flag<["-"], "fdebug-info-for-profiling">, 
Group,
+Flags<[CC1Option]>,
+HelpText<"Emit extra debug info to make sample profile more accurate.">;
+def fno_debug_info_for_profiling : Flag<["-"], 
"fno-debug-info-for-profiling">, Group,
+Flags<[DriverOption]>,
+HelpText<"Do not emit extra debug info for sample profiler.">;
 def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,
 Group, Flags<[CoreOption]>,
 HelpText<"Generate instrumented code to collect execution counts into 
default.profraw file (overriden by 

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-11 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment.

In https://reviews.llvm.org/D25435#619169, @hfinkel wrote:

> In https://reviews.llvm.org/D25435#609320, @danielcdh wrote:
>
> > change the flag name to -fprofile-debug
>
>
> I don't really like this name because it sounds like it might be enabling 
> some kind of debugging of the profiling. How about 
> -fdebug-info-for-profiling. Another options is to make it a mode for -g such 
> as -gprofiling.


Thanks for the comment. I'm OK with -fdebug-info-for-profiling. If no one 
objects, I'll update the patch tomorrow morning.

About -gprofiling, as discussed in 
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107454.html, this should 
be a -f option instead of -g option.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-11 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel added a comment.

In https://reviews.llvm.org/D25435#609320, @danielcdh wrote:

> change the flag name to -fprofile-debug


I don't really like this name because it sounds like it might be enabling some 
kind of debugging of the profiling. How about -fdebug-info-for-profiling. 
Another options is to make it a mode for -g such as -gprofiling.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-09 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfileDebug &&

echristo wrote:
> danielcdh wrote:
> > echristo wrote:
> > > Should we be encapsulating all of these for profile debug info? I.e. I 
> > > think coverage analysis is going to want the same things.
> > Do you mean that -fcoverage also implies -fprofile-debug?
> > 
> > I think the reason we introduce -fprofile-debug is that it has different 
> > requirments for debug info than coverage/sanitizer. E.g. we want to emit 
> > discriminator for -fprofile-debug, but not coverage/sanitizer.
> So, what are the differences here? I imagine that profile debugging will want 
> accurate source information. Perhaps we should hash this out in the thread 
> that dblaikie has started on llvm-dev.
The discussion about introducing this flag is in the thread of 
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107645.html

Basically -fprofile-debug not only requires accurate source information, it 
also requires:

>> 1. emit linkage name in all subprograms
>> 2. emit discriminator with dup-factor copy-factor encoded
>> 3. use-unknown-locations=true

The above 3 items are not required by -fcoverage. That's why we introduce 
-fprofile-debug to record these extra debug info.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-09 Thread Eric Christopher via Phabricator via cfe-commits
echristo added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfileDebug &&

danielcdh wrote:
> echristo wrote:
> > Should we be encapsulating all of these for profile debug info? I.e. I 
> > think coverage analysis is going to want the same things.
> Do you mean that -fcoverage also implies -fprofile-debug?
> 
> I think the reason we introduce -fprofile-debug is that it has different 
> requirments for debug info than coverage/sanitizer. E.g. we want to emit 
> discriminator for -fprofile-debug, but not coverage/sanitizer.
So, what are the differences here? I imagine that profile debugging will want 
accurate source information. Perhaps we should hash this out in the thread that 
dblaikie has started on llvm-dev.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-05 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfileDebug &&

echristo wrote:
> Should we be encapsulating all of these for profile debug info? I.e. I think 
> coverage analysis is going to want the same things.
Do you mean that -fcoverage also implies -fprofile-debug?

I think the reason we introduce -fprofile-debug is that it has different 
requirments for debug info than coverage/sanitizer. E.g. we want to emit 
discriminator for -fprofile-debug, but not coverage/sanitizer.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-05 Thread Eric Christopher via Phabricator via cfe-commits
echristo added inline comments.



Comment at: lib/CodeGen/CGDebugInfo.cpp:2743-2745
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfileDebug &&

Should we be encapsulating all of these for profile debug info? I.e. I think 
coverage analysis is going to want the same things.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-12-05 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh added a comment.

ping


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-11-30 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 79770.
danielcdh added a comment.

change the flag name to -fprofile-debug


https://reviews.llvm.org/D25435

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CGDebugInfo.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/clang_f_opts.c


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -469,3 +469,8 @@
 // CHECK-WCHAR2: -fshort-wchar
 // CHECK-WCHAR2-NOT: -fno-short-wchar
 // DELIMITERS: {{^ *"}}
+
+// RUN: %clang -### -S -fno-profile-debug -fprofile-debug %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROFILE-DEBUG %s
+// RUN: %clang -### -S -fprofile-debug -fno-profile-debug %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-PROFILE-DEBUG %s
+// CHECK-PROFILE-DEBUG: -fprofile-debug
+// CHECK-NO-PROFILE-DEBUG-NOT: -fprofile-debug
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -538,6 +538,8 @@
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
   Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
   Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
+  Opts.ProfileDebug = Args.hasFlag(OPT_fprofile_debug,
+OPT_fno_profile_debug, false);
 
   setPGOInstrumentor(Opts, Args, Diags);
   Opts.InstrProfileOutput =
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5508,6 +5508,10 @@
   A->render(Args, CmdArgs);
   }
 
+  if (Args.hasFlag(options::OPT_fprofile_debug,
+   options::OPT_fno_profile_debug, false))
+CmdArgs.push_back("-fprofile-debug");
+
   // -fbuiltin is default unless -mkernel is used.
   bool UseBuiltins =
   Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2739,9 +2739,10 @@
   }
   // No need to replicate the linkage name if it isn't different from the
   // subprogram name, no need to have it at all unless coverage is enabled or
-  // debug is set to more than just line tables.
+  // debug is set to more than just line tables or extra debug info is needed.
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfileDebug &&
   DebugKind <= 
codegenoptions::DebugLineTablesOnly))
 LinkageName = StringRef();
 
Index: lib/CodeGen/BackendUtil.cpp
===
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -576,6 +576,7 @@
   Options.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
   Options.CompressDebugSections = CodeGenOpts.CompressDebugSections;
   Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations;
+  Options.ProfileDebug = CodeGenOpts.ProfileDebug;
 
   // Set EABI version.
   Options.EABIVersion = llvm::StringSwitch(TargetOpts.EABIVersion)
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -256,6 +256,9 @@
 /// Whether copy relocations support is available when building as PIE.
 CODEGENOPT(PIECopyRelocations, 1, 0)
 
+/// Whether emit extra debug info for sample pgo profile collection.
+CODEGENOPT(ProfileDebug, 1, 0)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -509,6 +509,12 @@
 HelpText<"Enable sample-based profile guided optimizations">;
 def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,
 Alias;
+def fprofile_debug : Flag<["-"], "fprofile-debug">, Group,
+Flags<[CC1Option]>,
+HelpText<"Emit extra debug info to make sample profile more accurate.">;
+def fno_profile_debug : Flag<["-"], "fno-profile-debug">, Group,
+Flags<[DriverOption]>,
+HelpText<"Do not emit extra debug info for sample profiler.">;
 def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,
 Group, Flags<[DriverOption]>,
 HelpText<"Generate instrumented code to collect execution counts into 
default.profraw file (overriden by '=' form of option or LLVM_PROFILE_FILE env 
var)">;


Index: test/Driver/clang_f_opts.c
===
--- 

[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-11-29 Thread Greg Bedwell via Phabricator via cfe-commits
gbedwell added a comment.

In https://reviews.llvm.org/D25435#608348, @danielcdh wrote:

> Change the flag to -fprof-debug, which is more concise. The flag name is 
> still open for discussion.


Well, since I have permission to bikeshed... :)

I'd prefer to have 'profile' rather than 'prof' in the name.  This fits the 
established convention with -fprofile-sample-use etc.


https://reviews.llvm.org/D25435



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25435: Add -femit-accurate-debug-info to emit more debug info for sample pgo profile collection

2016-11-29 Thread Dehao Chen via Phabricator via cfe-commits
danielcdh updated this revision to Diff 79629.
danielcdh marked an inline comment as done.
danielcdh added a comment.

Change the flag to -fprof-debug, which is more concise. The flag name is still 
open for discussion.


https://reviews.llvm.org/D25435

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGDebugInfo.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/clang_f_opts.c


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -469,3 +469,8 @@
 // CHECK-WCHAR2: -fshort-wchar
 // CHECK-WCHAR2-NOT: -fno-short-wchar
 // DELIMITERS: {{^ *"}}
+
+// RUN: %clang -### -S -fno-prof-debug -fprof-debug %s 2>&1 | FileCheck 
-check-prefix=CHECK-PROF-DEBUG %s
+// RUN: %clang -### -S -fprof-debug -fno-prof-debug %s 2>&1 | FileCheck 
-check-prefix=CHECK-NO-PROF-DEBUG %s
+// CHECK-PROF-DEBUG: -fprof-debug
+// CHECK-NO-PROF-DEBUG-NOT: -fprof-debug
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -538,6 +538,7 @@
   Opts.DisableIntegratedAS = Args.hasArg(OPT_fno_integrated_as);
   Opts.Autolink = !Args.hasArg(OPT_fno_autolink);
   Opts.SampleProfileFile = Args.getLastArgValue(OPT_fprofile_sample_use_EQ);
+  Opts.ProfDebug = Args.hasFlag(OPT_fprof_debug, OPT_fno_prof_debug, false);
 
   setPGOInstrumentor(Opts, Args, Diags);
   Opts.InstrProfileOutput =
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5508,6 +5508,10 @@
   A->render(Args, CmdArgs);
   }
 
+  if (Args.hasFlag(options::OPT_fprof_debug,
+   options::OPT_fno_prof_debug, false))
+CmdArgs.push_back("-fprof-debug");
+
   // -fbuiltin is default unless -mkernel is used.
   bool UseBuiltins =
   Args.hasFlag(options::OPT_fbuiltin, options::OPT_fno_builtin,
Index: lib/CodeGen/CGDebugInfo.cpp
===
--- lib/CodeGen/CGDebugInfo.cpp
+++ lib/CodeGen/CGDebugInfo.cpp
@@ -2739,9 +2739,10 @@
   }
   // No need to replicate the linkage name if it isn't different from the
   // subprogram name, no need to have it at all unless coverage is enabled or
-  // debug is set to more than just line tables.
+  // debug is set to more than just line tables or extra debug info is needed.
   if (LinkageName == Name || (!CGM.getCodeGenOpts().EmitGcovArcs &&
   !CGM.getCodeGenOpts().EmitGcovNotes &&
+  !CGM.getCodeGenOpts().ProfDebug &&
   DebugKind <= 
codegenoptions::DebugLineTablesOnly))
 LinkageName = StringRef();
 
Index: include/clang/Frontend/CodeGenOptions.def
===
--- include/clang/Frontend/CodeGenOptions.def
+++ include/clang/Frontend/CodeGenOptions.def
@@ -256,6 +256,9 @@
 /// Whether copy relocations support is available when building as PIE.
 CODEGENOPT(PIECopyRelocations, 1, 0)
 
+/// Whether emit extra debug info for sample pgo profile collection.
+CODEGENOPT(ProfDebug, 1, 0)
+
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -509,6 +509,12 @@
 HelpText<"Enable sample-based profile guided optimizations">;
 def fauto_profile_EQ : Joined<["-"], "fauto-profile=">,
 Alias;
+def fprof_debug : Flag<["-"], "fprof-debug">, Group,
+Flags<[CC1Option]>,
+HelpText<"Emit extra debug info to make sample profile more accurate.">;
+def fno_prof_debug : Flag<["-"], "fno-prof-debug">, Group,
+Flags<[DriverOption]>,
+HelpText<"Do not emit extra debug info for sample profiler.">;
 def fprofile_instr_generate : Flag<["-"], "fprofile-instr-generate">,
 Group, Flags<[DriverOption]>,
 HelpText<"Generate instrumented code to collect execution counts into 
default.profraw file (overriden by '=' form of option or LLVM_PROFILE_FILE env 
var)">;


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -469,3 +469,8 @@
 // CHECK-WCHAR2: -fshort-wchar
 // CHECK-WCHAR2-NOT: -fno-short-wchar
 // DELIMITERS: {{^ *"}}
+
+// RUN: %clang -### -S -fno-prof-debug -fprof-debug %s 2>&1 | FileCheck -check-prefix=CHECK-PROF-DEBUG %s
+// RUN: %clang -### -S -fprof-debug -fno-prof-debug %s 2>&1 | FileCheck -check-prefix=CHECK-NO-PROF-DEBUG %s
+// CHECK-PROF-DEBUG: -fprof-debug
+// CHECK-NO-PROF-DEBUG-NOT: -fprof-debug
Index: lib/Frontend/CompilerInvocation.cpp