[PATCH] D121830: [memprof] Update the frame is inline logic and unittests.

Snehasish Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 21 10:42:02 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc9a3d29613db: [memprof] Update the frame is inline logic and unittests. (authored by snehasish).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121830

Files:
  llvm/lib/ProfileData/RawMemProfReader.cpp
  llvm/unittests/ProfileData/MemProfTest.cpp


Index: llvm/unittests/ProfileData/MemProfTest.cpp
===================================================================
--- llvm/unittests/ProfileData/MemProfTest.cpp
+++ llvm/unittests/ProfileData/MemProfTest.cpp
@@ -169,13 +169,13 @@
 
   EXPECT_EQ(Records[0].Info.getAllocCount(), 1U);
   EXPECT_EQ(Records[1].Info.getAllocCount(), 2U);
-  EXPECT_THAT(Records[0].CallStack[0], FrameContains("foo", 5U, 30U, false));
-  EXPECT_THAT(Records[0].CallStack[1], FrameContains("bar", 51U, 20U, true));
+  EXPECT_THAT(Records[0].CallStack[0], FrameContains("foo", 5U, 30U, true));
+  EXPECT_THAT(Records[0].CallStack[1], FrameContains("bar", 51U, 20U, false));
 
-  EXPECT_THAT(Records[1].CallStack[0], FrameContains("baz", 5U, 30U, false));
-  EXPECT_THAT(Records[1].CallStack[1], FrameContains("qux", 5U, 10U, true));
-  EXPECT_THAT(Records[1].CallStack[2], FrameContains("foo", 5U, 30U, false));
-  EXPECT_THAT(Records[1].CallStack[3], FrameContains("bar", 51U, 20U, true));
+  EXPECT_THAT(Records[1].CallStack[0], FrameContains("baz", 5U, 30U, true));
+  EXPECT_THAT(Records[1].CallStack[1], FrameContains("qux", 5U, 10U, false));
+  EXPECT_THAT(Records[1].CallStack[2], FrameContains("foo", 5U, 30U, true));
+  EXPECT_THAT(Records[1].CallStack[3], FrameContains("bar", 51U, 20U, false));
 }
 
 TEST(MemProf, PortableWrapper) {
Index: llvm/lib/ProfileData/RawMemProfReader.cpp
===================================================================
--- llvm/lib/ProfileData/RawMemProfReader.cpp
+++ llvm/lib/ProfileData/RawMemProfReader.cpp
@@ -325,7 +325,8 @@
         continue;
       }
 
-      for (size_t I = 0; I < DI.getNumberOfFrames(); I++) {
+      for (size_t I = 0, NumFrames = DI.getNumberOfFrames(); I < NumFrames;
+           I++) {
         const auto &Frame = DI.getFrame(I);
         LLVM_DEBUG(
             // Print out the name to guid mapping for debugging.
@@ -340,8 +341,8 @@
             // these suffixes will not be present.
             Function::getGUID(trimSuffix(Frame.FunctionName)),
             Frame.Line - Frame.StartLine, Frame.Column,
-            // Only the first entry is not an inlined location.
-            I != 0);
+            // Only the last entry is not an inlined location.
+            I != NumFrames - 1);
       }
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121830.417025.patch
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220321/67641420/attachment.bin>


More information about the llvm-commits mailing list