[compiler-rt] 56e205a - [Profile] Fix debug info correlation test failure on mac.

Zequan Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 08:30:36 PDT 2023


Author: Zequan Wu
Date: 2023-11-02T11:30:26-04:00
New Revision: 56e205a89cbb114750f2bd3f5cfbd19e209d018a

URL: https://github.com/llvm/llvm-project/commit/56e205a89cbb114750f2bd3f5cfbd19e209d018a
DIFF: https://github.com/llvm/llvm-project/commit/56e205a89cbb114750f2bd3f5cfbd19e209d018a.diff

LOG: [Profile] Fix debug info correlation test failure on mac.

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfiling.c
    llvm/lib/ProfileData/InstrProfCorrelator.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfiling.c b/compiler-rt/lib/profile/InstrProfiling.c
index 3285af4bf01f3c1..03b622b5e8e9468 100644
--- a/compiler-rt/lib/profile/InstrProfiling.c
+++ b/compiler-rt/lib/profile/InstrProfiling.c
@@ -90,6 +90,6 @@ COMPILER_RT_VISIBILITY void __llvm_profile_reset_counters(void) {
   lprofSetProfileDumped(0);
 }
 
-int hasCorrelation() {
+COMPILER_RT_VISIBILITY int hasCorrelation() {
   return (__llvm_profile_get_version() & VARIANT_MASK_DBG_CORRELATE) != 0ULL;
 }

diff  --git a/llvm/lib/ProfileData/InstrProfCorrelator.cpp b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
index e429b9f1da54cba..24d828f69c712b0 100644
--- a/llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ b/llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -74,12 +74,15 @@ InstrProfCorrelator::get(StringRef Filename, ProfCorrelatorKind FileKind) {
             "using multiple objects is not yet supported");
       Filename = *DsymObjectsOrErr->begin();
     }
-  }
-  auto BufferOrErr = errorOrToExpected(MemoryBuffer::getFile(Filename));
-  if (auto Err = BufferOrErr.takeError())
-    return std::move(Err);
+    auto BufferOrErr = errorOrToExpected(MemoryBuffer::getFile(Filename));
+    if (auto Err = BufferOrErr.takeError())
+      return std::move(Err);
 
-  return get(std::move(*BufferOrErr), FileKind);
+    return get(std::move(*BufferOrErr), FileKind);
+  }
+  return make_error<InstrProfError>(
+      instrprof_error::unable_to_correlate_profile,
+      "unsupported correlation kind (only DWARF debug info is supported)");
 }
 
 llvm::Expected<std::unique_ptr<InstrProfCorrelator>>


        


More information about the llvm-commits mailing list