r295764 - Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

Dehao Chen via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 21 12:36:21 PST 2017


Author: dehao
Date: Tue Feb 21 14:36:21 2017
New Revision: 295764

URL: http://llvm.org/viewvc/llvm-project?rev=295764&view=rev
Log:
Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

Summary: AddDiscriminator pass is only useful for sample pgo. This patch restricts AddDiscriminator to -fdebug-info-for-profiling so that it does not introduce unecessary debug size increases for non-sample-pgo builds.

Reviewers: dblaikie, aprantl

Reviewed By: dblaikie

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D30220

Modified:
    cfe/trunk/lib/CodeGen/BackendUtil.cpp
    cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=295764&r1=295763&r2=295764&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Tue Feb 21 14:36:21 2017
@@ -339,8 +339,10 @@ void EmitAssemblyHelper::CreatePasses(le
   if (TM)
     TM->adjustPassManager(PMBuilder);
 
-  PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
-                         addAddDiscriminatorsPass);
+  if (CodeGenOpts.DebugInfoForProfiling ||
+      !CodeGenOpts.SampleProfileFile.empty())
+    PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
+                           addAddDiscriminatorsPass);
 
   // In ObjC ARC mode, add the main ARC optimization passes.
   if (LangOpts.ObjCAutoRefCount) {

Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=295764&r1=295763&r2=295764&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Tue Feb 21 14:36:21 2017
@@ -30,11 +30,10 @@ NSRect NSMakeRect(CGFloat x, CGFloat y,
   // 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




More information about the cfe-commits mailing list