[PATCH] D80646: [PGO] Guard the memcmp/bcmp size value profiling instrumentation behind flag.
Hiroshi Yamauchi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 27 10:50:24 PDT 2020
yamauchi created this revision.
yamauchi added a reviewer: davidxl.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Follow up D79751 <https://reviews.llvm.org/D79751> and put the instrumentation / value collection side (in
addition to the optimization side) behind the flag as well.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80646
Files:
llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
llvm/test/Transforms/PGOProfile/memop_size_annotation.ll
Index: llvm/test/Transforms/PGOProfile/memop_size_annotation.ll
===================================================================
--- llvm/test/Transforms/PGOProfile/memop_size_annotation.ll
+++ llvm/test/Transforms/PGOProfile/memop_size_annotation.ll
@@ -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"
Index: llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
===================================================================
--- llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
+++ llvm/lib/Transforms/Instrumentation/ValueProfilePlugins.inc
@@ -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 @@
Candidates->emplace_back(CandidateInfo{Length, InsertPt, AnnotatedInst});
}
void visitCallInst(CallInst &CI) {
+ if (!MemOPOptMemcmpBcmp)
+ return;
auto *F = CI.getCalledFunction();
if (!F)
return;
Index: llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
+++ llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
@@ -95,7 +95,7 @@
// 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"));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80646.266591.patch
Type: text/x-patch
Size: 3274 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200527/78638b95/attachment.bin>
More information about the llvm-commits
mailing list