diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp index 351e81aac05db..f79867cf38d14 100644 --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/lib/Analysis/MemoryBuiltins.cpp @@ -315,6 +315,12 @@ static bool isMallocLikeFn(const Value *V, const TargetLibraryInfo *TLI) { return getAllocationData(V, MallocOrOpNewLike, TLI).has_value(); } +/// Tests if a value is a call or invoke to a library function that +/// allocates memory via new. +bool llvm::isNewLikeFn(const Value *V, const TargetLibraryInfo *TLI) { + return getAllocationData(V, OpNewLike, TLI).hasValue(); +} + /// Tests if a value is a call or invoke to a library function that /// allocates uninitialized memory with alignment (such as aligned_alloc). static bool isAlignedAllocLikeFn(const Value *V, const TargetLibraryInfo *TLI) { diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 6bb29a0f34acf..3098dd95a3594 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -1037,6 +1037,9 @@ class PGOUseFunc { // Read memprof data for the instrumented function from profile. bool readMemprof(IndexedInstrProfReader *PGOReader); + // Read memprof data for the instrumented function from profile. + bool readMemprof(IndexedInstrProfReader *PGOReader); + // Populate the counts for all BBs. void populateCounters();