forked from OSchip/llvm-project
[PGO] Guard the memcmp/bcmp size value profiling instrumentation behind flag.
Summary: Follow up D79751 and put the instrumentation / value collection side (in addition to the optimization side) behind the flag as well. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80646
This commit is contained in:
parent
69ede516c7
commit
f0c2cfe4d0
|
@ -95,7 +95,7 @@ extern cl::opt<std::string> MemOPSizeRange;
|
|||
// This option sets the value that groups large memop sizes
|
||||
extern cl::opt<unsigned> MemOPSizeLarge;
|
||||
|
||||
static cl::opt<bool>
|
||||
cl::opt<bool>
|
||||
MemOPOptMemcmpBcmp("pgo-memop-optimize-memcmp-bcmp", cl::init(false),
|
||||
cl::Hidden,
|
||||
cl::desc("Size-specialize memcmp and bcmp calls"));
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
using namespace llvm;
|
||||
using CandidateInfo = ValueProfileCollector::CandidateInfo;
|
||||
|
||||
extern cl::opt<bool> MemOPOptMemcmpBcmp;
|
||||
|
||||
///--------------------------- MemIntrinsicPlugin ------------------------------
|
||||
class MemIntrinsicPlugin : public InstVisitor<MemIntrinsicPlugin> {
|
||||
Function &F;
|
||||
|
@ -48,6 +50,8 @@ public:
|
|||
Candidates->emplace_back(CandidateInfo{Length, InsertPt, AnnotatedInst});
|
||||
}
|
||||
void visitCallInst(CallInst &CI) {
|
||||
if (!MemOPOptMemcmpBcmp)
|
||||
return;
|
||||
auto *F = CI.getCalledFunction();
|
||||
if (!F)
|
||||
return;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
; RUN: llvm-profdata merge %S/Inputs/memop_size_annotation.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9
|
||||
; RUN: opt < %s -passes=pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4
|
||||
; RUN: opt < %s -pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -pgo-memop-optimize-memcmp-bcmp -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9
|
||||
; RUN: opt < %s -passes=pgo-instr-use -memop-max-annotations=9 -pgo-test-profile-file=%t.profdata -pgo-memop-optimize-memcmp-bcmp -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION9
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-memop-optimize-memcmp-bcmp -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-memop-optimize-memcmp-bcmp -S | FileCheck %s --check-prefixes=MEMOP_ANNOTATION,MEMOP_ANNOTATION4
|
||||
|
||||
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
|
Loading…
Reference in New Issue