[llvm] cb81545 - [memprof] Add LLVM_DEBUG for unused var in RawMemProfReader.cpp.

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 16:03:00 PST 2022


Author: Snehasish Kumar
Date: 2022-02-08T16:02:24-08:00
New Revision: cb81545e7dcf717696a4a4de237d55a9a3cc6a85

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

LOG: [memprof] Add LLVM_DEBUG for unused var in RawMemProfReader.cpp.

The ContainingSegment variable is only used to check whether we found
the address at this time. When building without Asserts this emits a
warning. So for now wrap this code in LLVM_DEBUG to avoid the warning.

Added: 
    

Modified: 
    llvm/lib/ProfileData/RawMemProfReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ProfileData/RawMemProfReader.cpp b/llvm/lib/ProfileData/RawMemProfReader.cpp
index d13d51d68025..335ec04bc098 100644
--- a/llvm/lib/ProfileData/RawMemProfReader.cpp
+++ b/llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -28,6 +28,8 @@
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/MD5.h"
 
+#define DEBUG_TYPE "memprof"
+
 namespace llvm {
 namespace memprof {
 namespace {
@@ -326,6 +328,7 @@ Error RawMemProfReader::readRawProfile() {
 
 object::SectionedAddress
 RawMemProfReader::getModuleOffset(const uint64_t VirtualAddress) {
+  LLVM_DEBUG({
   SegmentEntry *ContainingSegment = nullptr;
   for (auto &SE : SegmentInfo) {
     if (VirtualAddress > SE.Start && VirtualAddress <= SE.End) {
@@ -335,6 +338,7 @@ RawMemProfReader::getModuleOffset(const uint64_t VirtualAddress) {
 
   // Ensure that the virtual address is valid.
   assert(ContainingSegment && "Could not find a segment entry");
+  });
 
   // TODO: Compute the file offset based on the maps and program headers. For
   // now this only works for non PIE binaries.


        


More information about the llvm-commits mailing list