Index: lib/CodeGen/BackendUtil.cpp =================================================================== --- lib/CodeGen/BackendUtil.cpp +++ lib/CodeGen/BackendUtil.cpp @@ -339,8 +339,9 @@ if (TM) TM->adjustPassManager(PMBuilder); - PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, - addAddDiscriminatorsPass); + if (CodeGenOpts.DebugInfoForProfiling) + PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, + addAddDiscriminatorsPass); // In ObjC ARC mode, add the main ARC optimization passes. if (LangOpts.ObjCAutoRefCount) { Index: lib/Frontend/CompilerInvocation.cpp =================================================================== --- lib/Frontend/CompilerInvocation.cpp +++ lib/Frontend/CompilerInvocation.cpp @@ -545,8 +545,9 @@ 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); + Opts.DebugInfoForProfiling = Args.hasFlag(OPT_fdebug_info_for_profiling, + OPT_fno_debug_info_for_profiling, + !Opts.SampleProfileFile.empty()); setPGOInstrumentor(Opts, Args, Diags); Opts.InstrProfileOutput = Index: test/CodeGenObjC/arc-linetable-autorelease.m =================================================================== --- test/CodeGenObjC/arc-linetable-autorelease.m +++ test/CodeGenObjC/arc-linetable-autorelease.m @@ -30,11 +30,10 @@ // CHECK: define {{.*}}_createBezierPathWithWidth // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]] // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]] - // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC1:[0-9]+]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]] // CHECK: ret {{.*}} !dbg ![[ARC]] // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) return path; - // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}}) - // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) + // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) } @end