[PATCH] D22030: [PGO] Change the ProfileSummary metadata merge behavior

Jake VanAdrighem via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 5 20:17:53 PDT 2016


jakev created this revision.
jakev added reviewers: eraman, davidxl, silvas.
jakev added a subscriber: llvm-commits.
jakev set the repository for this revision to rL LLVM.

The behavior when merging different ProfileSummary metadata really shouldn't be to throw an Error. This prevents users from doing LTO builds including IR files with older/different profile data applied.

Even if people think changing the behavior to Warning isn't the right approach, it would be good to move away from intentional failure.

Repository:
  rL LLVM

http://reviews.llvm.org/D22030

Files:
  lib/IR/Module.cpp
  test/Transforms/PGOProfile/PR28219.ll
  test/Transforms/PGOProfile/branch1.ll
  test/Transforms/SampleProfile/summary.ll

Index: test/Transforms/SampleProfile/summary.ll
===================================================================
--- test/Transforms/SampleProfile/summary.ll
+++ test/Transforms/SampleProfile/summary.ll
@@ -6,7 +6,7 @@
   ret i32 1, !dbg !2
 }
 
-; CHECK-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
+; CHECK-DAG: {{![0-9]+}} = !{i32 2, !"ProfileSummary", {{![0-9]+}}}
 ; CHECK-DAG: {{![0-9]+}} = !{!"NumFunctions", i64 2}
 ; CHECK-DAG: {{![0-9]+}} = !{!"MaxFunctionCount", i64 3}
 
Index: test/Transforms/PGOProfile/branch1.ll
===================================================================
--- test/Transforms/PGOProfile/branch1.ll
+++ test/Transforms/PGOProfile/branch1.ll
@@ -44,6 +44,6 @@
   %retv = phi i32 [ %add, %if.then ], [ %i, %entry ]
   ret i32 %retv
 }
-; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
+; USE-DAG: {{![0-9]+}} = !{i32 2, !"ProfileSummary", {{![0-9]+}}}
 ; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}}
 ; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3}
Index: test/Transforms/PGOProfile/PR28219.ll
===================================================================
--- test/Transforms/PGOProfile/PR28219.ll
+++ test/Transforms/PGOProfile/PR28219.ll
@@ -6,7 +6,7 @@
 entry:
   ret i32 1
 }
-; CHECK-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
+; CHECK-DAG: {{![0-9]+}} = !{i32 2, !"ProfileSummary", {{![0-9]+}}}
 ; CHECK-DAG: {{![0-9]+}} = !{!"NumFunctions", i64 2}
 ; CHECK-DAG: {{![0-9]+}} = !{!"MaxFunctionCount", i64 3}
 
Index: lib/IR/Module.cpp
===================================================================
--- lib/IR/Module.cpp
+++ lib/IR/Module.cpp
@@ -512,7 +512,7 @@
 }
 
 void Module::setProfileSummary(Metadata *M) {
-  addModuleFlag(ModFlagBehavior::Error, "ProfileSummary", M);
+  addModuleFlag(ModFlagBehavior::Warning, "ProfileSummary", M);
 }
 
 Metadata *Module::getProfileSummary() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22030.62818.patch
Type: text/x-patch
Size: 1927 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160706/fd261f17/attachment.bin>


More information about the llvm-commits mailing list