[MemProf] Stop cloning traversal on single allocation type (#126131)
We were previously checking this after recursing on all callers, but if
we already have a single allocation type there is no need to even look
at any callers. Didn't show a significant improvement overall, but it
does reduce the count of times we enter the identifyClones and do other
checks.
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index f6764be..d748b16 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -3407,6 +3407,10 @@
if (!Node->hasCall())
return;
+ // No need to look at any callers if allocation type already unambiguous.
+ if (hasSingleAllocType(Node->AllocTypes))
+ return;
+
#ifndef NDEBUG
auto Insert =
#endif