diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp index f6764be9b273e..d748b162d7809 100644 --- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp +++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp @@ -3407,6 +3407,10 @@ void CallsiteContextGraph::identifyClones( 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