[PATCH] D124169: [SelectionDAG] Add statistics for inline emission of memory intrinsics
Alexander Richardson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 06:43:53 PDT 2022
arichardson created this revision.
Herald added subscribers: ecnelises, hiraditya.
Herald added a project: All.
arichardson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
While doing some benchmark performance comparison analysis I noticed that
one version was performing noticeably worse due to additional calls to
memcpy() being generated. These statistics have been useful when looking
into memcpy() inlining behaviour for the CHERI LLVM fork, and are hopefully
also useful upstream.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124169
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -22,6 +22,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/MemoryLocation.h"
@@ -95,6 +96,10 @@
#define DEBUG_TYPE "selectiondag"
+STATISTIC(MemcpyInline, "Number of memcpy() calls emitted inline");
+STATISTIC(MemmoveInline, "Number of memmove() calls emitted inline");
+STATISTIC(MemsetInline, "Number of memset() calls emitted inline");
+
static cl::opt<bool> EnableMemCpyDAGOpt("enable-memcpy-dag-opt",
cl::Hidden, cl::init(true),
cl::desc("Gang up loads and stores generated by inlining of memcpy"));
@@ -6820,6 +6825,8 @@
}
}
}
+
+ MemcpyInline++;
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains);
}
@@ -6917,6 +6924,7 @@
DstOff += VTSize;
}
+ MemmoveInline++;
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains);
}
@@ -7025,6 +7033,7 @@
Size -= VTSize;
}
+ MemsetInline++;
return DAG.getNode(ISD::TokenFactor, dl, MVT::Other, OutChains);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124169.424182.patch
Type: text/x-patch
Size: 1354 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220421/78a982f9/attachment.bin>
More information about the llvm-commits
mailing list