[PATCH] D30220: Only enable AddDiscriminator pass when -fdebug-info-for-profiling is true

Dehao Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 21 11:59:55 PST 2017


danielcdh updated this revision to Diff 89258.
danielcdh added a comment.

update


https://reviews.llvm.org/D30220

Files:
  lib/CodeGen/BackendUtil.cpp
  test/CodeGenObjC/arc-linetable-autorelease.m


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
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -339,8 +339,10 @@
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30220.89258.patch
Type: text/x-patch
Size: 1603 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170221/f82183a0/attachment.bin>


More information about the cfe-commits mailing list