[PATCH] D99457: [llvm-profdata] Make sure to consume Error on the error path of setIsIRLevelProfile

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 29 23:53:13 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG142d522dedbb: [llvm-profdata] Make sure to consume Error on the error path of… (authored by zero9178).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99457/new/

https://reviews.llvm.org/D99457

Files:
  llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext
  llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext
  llvm/test/tools/llvm-profdata/merge-incompatible.test
  llvm/tools/llvm-profdata/llvm-profdata.cpp


Index: llvm/tools/llvm-profdata/llvm-profdata.cpp
===================================================================
--- llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -251,7 +251,8 @@
   auto Reader = std::move(ReaderOrErr.get());
   bool IsIRProfile = Reader->isIRLevelProfile();
   bool HasCSIRProfile = Reader->hasCSIRLevelProfile();
-  if (WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
+  if (Error E = WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) {
+    consumeError(std::move(E));
     WC->Errors.emplace_back(
         make_error<StringError>(
             "Merge IR generated profile with Clang generated profile.",
Index: llvm/test/tools/llvm-profdata/merge-incompatible.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profdata/merge-incompatible.test
@@ -0,0 +1,2 @@
+RUN: not llvm-profdata merge %p/Inputs/fe-basic.proftext %p/Inputs/ir-basic.proftext -o /dev/null 2>&1 | FileCheck %s
+CHECK: ir-basic.proftext: Merge IR generated profile with Clang generated profile.
Index: llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profdata/Inputs/ir-basic.proftext
@@ -0,0 +1,6 @@
+:ir
+foo2
+29667547796
+2
+100
+90
Index: llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-profdata/Inputs/fe-basic.proftext
@@ -0,0 +1,6 @@
+:fe
+foo
+29667547796
+2
+100
+90


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99457.334060.patch
Type: text/x-patch
Size: 1634 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210330/89a9f1c2/attachment.bin>


More information about the llvm-commits mailing list