1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[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:
Hiroshi Yamauchi 2020-05-27 10:13:33 -07:00
parent eccf8034a4
commit f331ef22e8
3 changed files with 9 additions and 5 deletions

View File

@ -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"));

View File

@ -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;

View File

@ -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"