summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/test/CodeGenCXX/Inputs/profile-remap-error.map1
-rw-r--r--clang/test/CodeGenCXX/profile-remap-error.cpp7
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp3
3 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/CodeGenCXX/Inputs/profile-remap-error.map b/clang/test/CodeGenCXX/Inputs/profile-remap-error.map
new file mode 100644
index 00000000000..feb6ce75a5d
--- /dev/null
+++ b/clang/test/CodeGenCXX/Inputs/profile-remap-error.map
@@ -0,0 +1 @@
+name unmangled ignored
diff --git a/clang/test/CodeGenCXX/profile-remap-error.cpp b/clang/test/CodeGenCXX/profile-remap-error.cpp
new file mode 100644
index 00000000000..0a04e85a20a
--- /dev/null
+++ b/clang/test/CodeGenCXX/profile-remap-error.cpp
@@ -0,0 +1,7 @@
+// REQUIRES: x86-registered-target
+
+// RUN: not %clang_cc1 -triple x86_64-linux-gnu -fprofile-sample-use=%S/Inputs/profile-remap.samples -fprofile-remapping-file=%S/Inputs/profile-remap-error.map -fexperimental-new-pass-manager -O2 %s -emit-llvm -o - 2>&1 | FileCheck %s
+
+// CHECK: error: {{.*}}/profile-remap-error.map:1: Could not demangle 'unmangled' as a <name>; invalid mangling?
+// CHECK-NEXT: error: {{.*}}/profile-remap-error.map: Could not create remapper: Malformed sample profile data
+// CHECK-NEXT: error: {{.*}}/profile-remap.samples: Could not open profile: Malformed sample profile data
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 2b169638d40..a1fbb1adc41 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -1973,7 +1973,8 @@ PreservedAnalyses SampleProfileLoaderPass::run(Module &M,
: ProfileRemappingFileName,
IsThinLTOPreLink, GetAssumptionCache, GetTTI);
- SampleLoader.doInitialization(M);
+ if (!SampleLoader.doInitialization(M))
+ return PreservedAnalyses::all();
ProfileSummaryInfo *PSI = &AM.getResult<ProfileSummaryAnalysis>(M);
CallGraph &CG = AM.getResult<CallGraphAnalysis>(M);
OpenPOWER on IntegriCloud