[llvm] [SampleFDO] Improve stale profile matching by diff algorithm (PR #87375)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 16:54:25 PDT 2024


================
@@ -19,6 +19,59 @@
 
 namespace llvm {
 
+// Callsite location based matching anchor.
+struct Anchor {
+  LineLocation Loc;
+  FunctionId FuncId;
+
+  Anchor(const LineLocation &Loc, const FunctionId &FuncId)
+      : Loc(Loc), FuncId(FuncId) {}
+  Anchor(const LineLocation &Loc, StringRef &FName) : Loc(Loc), FuncId(FName) {}
+  bool operator==(const Anchor &Other) const {
----------------
WenleiHe wrote:

Why do we not compare `Loc` as well? 

Except for this special operator== that excludes Loc, this is essentially just a `typedef pair<LineLocation, FunctionId> Anchor`?

https://github.com/llvm/llvm-project/pull/87375


More information about the llvm-commits mailing list