mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[PGO] Supporting code for always instrumenting entry block
This patch includes the supporting code that enables always instrumenting the function entry block by default. This patch will NOT the default behavior. It adds a variant bit in the profile version, adds new directives in text profile format, and changes llvm-profdata tool accordingly. This patch is a split of D83024 (https://reviews.llvm.org/D83024) Many test changes from D83024 are also included. Differential Revision: https://reviews.llvm.org/D84261
This commit is contained in:
parent
7da3e6e3f5
commit
005085c634
@ -1146,7 +1146,8 @@ void getMemOPSizeRangeFromOption(StringRef Str, int64_t &RangeStart,
|
||||
|
||||
// Create a COMDAT variable INSTR_PROF_RAW_VERSION_VAR to make the runtime
|
||||
// aware this is an ir_level profile so it can set the version flag.
|
||||
void createIRLevelProfileFlagVar(Module &M, bool IsCS);
|
||||
void createIRLevelProfileFlagVar(Module &M, bool IsCS,
|
||||
bool InstrEntryBBEnabled);
|
||||
|
||||
// Create the variable for the profile file name.
|
||||
void createProfileFileNameVar(Module &M, StringRef InstrProfileOutput);
|
||||
|
@ -673,6 +673,7 @@ serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
|
||||
#define GET_VERSION(V) ((V) & ~VARIANT_MASKS_ALL)
|
||||
#define VARIANT_MASK_IR_PROF (0x1ULL << 56)
|
||||
#define VARIANT_MASK_CSIR_PROF (0x1ULL << 57)
|
||||
#define VARIANT_MASK_INSTR_ENTRY (0x1ULL << 58)
|
||||
#define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version
|
||||
#define INSTR_PROF_PROFILE_RUNTIME_VAR __llvm_profile_runtime
|
||||
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
|
||||
virtual bool hasCSIRLevelProfile() const = 0;
|
||||
|
||||
virtual bool instrEntryBBEnabled() const = 0;
|
||||
|
||||
/// Return the PGO symtab. There are three different readers:
|
||||
/// Raw, Text, and Indexed profile readers. The first two types
|
||||
/// of readers are used only by llvm-profdata tool, while the indexed
|
||||
@ -148,6 +150,7 @@ private:
|
||||
line_iterator Line;
|
||||
bool IsIRLevelProfile = false;
|
||||
bool HasCSIRLevelProfile = false;
|
||||
bool InstrEntryBBEnabled = false;
|
||||
|
||||
Error readValueProfileData(InstrProfRecord &Record);
|
||||
|
||||
@ -164,6 +167,8 @@ public:
|
||||
|
||||
bool hasCSIRLevelProfile() const override { return HasCSIRLevelProfile; }
|
||||
|
||||
bool instrEntryBBEnabled() const override { return InstrEntryBBEnabled; }
|
||||
|
||||
/// Read the header.
|
||||
Error readHeader() override;
|
||||
|
||||
@ -224,6 +229,10 @@ public:
|
||||
return (Version & VARIANT_MASK_CSIR_PROF) != 0;
|
||||
}
|
||||
|
||||
bool instrEntryBBEnabled() const override {
|
||||
return (Version & VARIANT_MASK_INSTR_ENTRY) != 0;
|
||||
}
|
||||
|
||||
InstrProfSymtab &getSymtab() override {
|
||||
assert(Symtab.get());
|
||||
return *Symtab.get();
|
||||
@ -360,6 +369,7 @@ struct InstrProfReaderIndexBase {
|
||||
virtual uint64_t getVersion() const = 0;
|
||||
virtual bool isIRLevelProfile() const = 0;
|
||||
virtual bool hasCSIRLevelProfile() const = 0;
|
||||
virtual bool instrEntryBBEnabled() const = 0;
|
||||
virtual Error populateSymtab(InstrProfSymtab &) = 0;
|
||||
};
|
||||
|
||||
@ -408,6 +418,10 @@ public:
|
||||
return (FormatVersion & VARIANT_MASK_CSIR_PROF) != 0;
|
||||
}
|
||||
|
||||
bool instrEntryBBEnabled() const override {
|
||||
return (FormatVersion & VARIANT_MASK_INSTR_ENTRY) != 0;
|
||||
}
|
||||
|
||||
Error populateSymtab(InstrProfSymtab &Symtab) override {
|
||||
return Symtab.create(HashTable->keys());
|
||||
}
|
||||
@ -462,6 +476,10 @@ public:
|
||||
return Index->hasCSIRLevelProfile();
|
||||
}
|
||||
|
||||
bool instrEntryBBEnabled() const override {
|
||||
return Index->instrEntryBBEnabled();
|
||||
}
|
||||
|
||||
/// Return true if the given buffer is in an indexed instrprof format.
|
||||
static bool hasFormat(const MemoryBuffer &DataBuffer);
|
||||
|
||||
|
@ -40,11 +40,12 @@ private:
|
||||
bool Sparse;
|
||||
StringMap<ProfilingData> FunctionData;
|
||||
ProfKind ProfileKind = PF_Unknown;
|
||||
bool InstrEntryBBEnabled;
|
||||
// Use raw pointer here for the incomplete type object.
|
||||
InstrProfRecordWriterTrait *InfoObj;
|
||||
|
||||
public:
|
||||
InstrProfWriter(bool Sparse = false);
|
||||
InstrProfWriter(bool Sparse = false, bool InstrEntryBBEnabled = false);
|
||||
~InstrProfWriter();
|
||||
|
||||
/// Add function counts for the given function. If there are already counts
|
||||
@ -97,6 +98,7 @@ public:
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
void setInstrEntryBBEnabled(bool Enabled) { InstrEntryBBEnabled = Enabled; }
|
||||
// Internal interface for testing purpose only.
|
||||
void setValueProfDataEndianness(support::endianness Endianness);
|
||||
void setOutputSparse(bool Sparse);
|
||||
|
@ -1136,12 +1136,15 @@ void getMemOPSizeRangeFromOption(StringRef MemOPSizeRange, int64_t &RangeStart,
|
||||
|
||||
// Create a COMDAT variable INSTR_PROF_RAW_VERSION_VAR to make the runtime
|
||||
// aware this is an ir_level profile so it can set the version flag.
|
||||
void createIRLevelProfileFlagVar(Module &M, bool IsCS) {
|
||||
void createIRLevelProfileFlagVar(Module &M, bool IsCS,
|
||||
bool InstrEntryBBEnabled) {
|
||||
const StringRef VarName(INSTR_PROF_QUOTE(INSTR_PROF_RAW_VERSION_VAR));
|
||||
Type *IntTy64 = Type::getInt64Ty(M.getContext());
|
||||
uint64_t ProfileVersion = (INSTR_PROF_RAW_VERSION | VARIANT_MASK_IR_PROF);
|
||||
if (IsCS)
|
||||
ProfileVersion |= VARIANT_MASK_CSIR_PROF;
|
||||
if (InstrEntryBBEnabled)
|
||||
ProfileVersion |= VARIANT_MASK_INSTR_ENTRY;
|
||||
auto IRLevelVersionVariable = new GlobalVariable(
|
||||
M, IntTy64, true, GlobalValue::WeakAnyLinkage,
|
||||
Constant::getIntegerValue(IntTy64, APInt(64, ProfileVersion)), VarName);
|
||||
|
@ -154,23 +154,29 @@ bool TextInstrProfReader::hasFormat(const MemoryBuffer &Buffer) {
|
||||
Error TextInstrProfReader::readHeader() {
|
||||
Symtab.reset(new InstrProfSymtab());
|
||||
bool IsIRInstr = false;
|
||||
if (!Line->startswith(":")) {
|
||||
IsIRLevelProfile = false;
|
||||
return success();
|
||||
}
|
||||
StringRef Str = (Line)->substr(1);
|
||||
if (Str.equals_lower("ir"))
|
||||
IsIRInstr = true;
|
||||
else if (Str.equals_lower("fe"))
|
||||
IsIRInstr = false;
|
||||
else if (Str.equals_lower("csir")) {
|
||||
IsIRInstr = true;
|
||||
HasCSIRLevelProfile = true;
|
||||
} else
|
||||
return error(instrprof_error::bad_header);
|
||||
bool IsEntryFirst = false;
|
||||
bool IsCS = false;
|
||||
|
||||
++Line;
|
||||
while (Line->startswith(":")) {
|
||||
StringRef Str = Line->substr(1);
|
||||
if (Str.equals_lower("ir"))
|
||||
IsIRInstr = true;
|
||||
else if (Str.equals_lower("fe"))
|
||||
IsIRInstr = false;
|
||||
else if (Str.equals_lower("csir")) {
|
||||
IsIRInstr = true;
|
||||
IsCS = true;
|
||||
} else if (Str.equals_lower("entry_first"))
|
||||
IsEntryFirst = true;
|
||||
else if (Str.equals_lower("not_entry_first"))
|
||||
IsEntryFirst = false;
|
||||
else
|
||||
return error(instrprof_error::bad_header);
|
||||
++Line;
|
||||
}
|
||||
IsIRLevelProfile = IsIRInstr;
|
||||
InstrEntryBBEnabled = IsEntryFirst;
|
||||
HasCSIRLevelProfile = IsCS;
|
||||
return success();
|
||||
}
|
||||
|
||||
|
@ -165,8 +165,9 @@ public:
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
InstrProfWriter::InstrProfWriter(bool Sparse)
|
||||
: Sparse(Sparse), InfoObj(new InstrProfRecordWriterTrait()) {}
|
||||
InstrProfWriter::InstrProfWriter(bool Sparse, bool InstrEntryBBEnabled)
|
||||
: Sparse(Sparse), InstrEntryBBEnabled(InstrEntryBBEnabled),
|
||||
InfoObj(new InstrProfRecordWriterTrait()) {}
|
||||
|
||||
InstrProfWriter::~InstrProfWriter() { delete InfoObj; }
|
||||
|
||||
@ -308,6 +309,9 @@ void InstrProfWriter::writeImpl(ProfOStream &OS) {
|
||||
Header.Version |= VARIANT_MASK_IR_PROF;
|
||||
Header.Version |= VARIANT_MASK_CSIR_PROF;
|
||||
}
|
||||
if (InstrEntryBBEnabled)
|
||||
Header.Version |= VARIANT_MASK_INSTR_ENTRY;
|
||||
|
||||
Header.Unused = 0;
|
||||
Header.HashType = static_cast<uint64_t>(IndexedInstrProf::HashType);
|
||||
Header.HashOffset = 0;
|
||||
@ -441,6 +445,8 @@ Error InstrProfWriter::writeText(raw_fd_ostream &OS) {
|
||||
OS << "# IR level Instrumentation Flag\n:ir\n";
|
||||
else if (ProfileKind == PF_IRLevelWithCS)
|
||||
OS << "# CSIR level Instrumentation Flag\n:csir\n";
|
||||
if (InstrEntryBBEnabled)
|
||||
OS << "# Always instrument the function entry block\n:entry_first\n";
|
||||
InstrProfSymtab Symtab;
|
||||
|
||||
using FuncPair = detail::DenseMapPair<uint64_t, InstrProfRecord>;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "llvm/Analysis/BranchProbabilityInfo.h"
|
||||
#include "llvm/Analysis/CFG.h"
|
||||
#include "llvm/Support/BranchProbability.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
|
||||
@ -30,9 +29,6 @@
|
||||
#define DEBUG_TYPE "cfgmst"
|
||||
|
||||
using namespace llvm;
|
||||
static cl::opt<bool> PGOInstrumentEntry(
|
||||
"pgo-instrument-entry", cl::init(false), cl::Hidden,
|
||||
cl::desc("Force to instrument function entry basicblock."));
|
||||
|
||||
namespace llvm {
|
||||
|
||||
@ -107,7 +103,7 @@ public:
|
||||
const BasicBlock *Entry = &(F.getEntryBlock());
|
||||
uint64_t EntryWeight = (BFI != nullptr ? BFI->getEntryFreq() : 2);
|
||||
// If we want to instrument the entry count, lower the weight to 0.
|
||||
if (PGOInstrumentEntry)
|
||||
if (InstrumentFuncEntry)
|
||||
EntryWeight = 0;
|
||||
Edge *EntryIncoming = nullptr, *EntryOutgoing = nullptr,
|
||||
*ExitOutgoing = nullptr, *ExitIncoming = nullptr;
|
||||
@ -282,14 +278,19 @@ public:
|
||||
BranchProbabilityInfo *BPI;
|
||||
BlockFrequencyInfo *BFI;
|
||||
|
||||
// If function entry will be always instrumented.
|
||||
bool InstrumentFuncEntry;
|
||||
|
||||
public:
|
||||
CFGMST(Function &Func, BranchProbabilityInfo *BPI_ = nullptr,
|
||||
CFGMST(Function &Func, bool InstrumentFuncEntry_,
|
||||
BranchProbabilityInfo *BPI_ = nullptr,
|
||||
BlockFrequencyInfo *BFI_ = nullptr)
|
||||
: F(Func), BPI(BPI_), BFI(BFI_) {
|
||||
: F(Func), BPI(BPI_), BFI(BFI_),
|
||||
InstrumentFuncEntry(InstrumentFuncEntry_) {
|
||||
buildEdges();
|
||||
sortEdgesByWeight();
|
||||
computeMinimumSpanningTree();
|
||||
if (PGOInstrumentEntry && (AllEdges.size() > 1))
|
||||
if (AllEdges.size() > 1 && InstrumentFuncEntry)
|
||||
std::iter_swap(std::move(AllEdges.begin()),
|
||||
std::move(AllEdges.begin() + AllEdges.size() - 1));
|
||||
}
|
||||
|
@ -249,6 +249,10 @@ static cl::opt<bool>
|
||||
"optimization remarks: -{Rpass|"
|
||||
"pass-remarks}=pgo-instrumentation"));
|
||||
|
||||
static cl::opt<bool> PGOInstrumentEntry(
|
||||
"pgo-instrument-entry", cl::init(false), cl::Hidden,
|
||||
cl::desc("Force to instrument function entry basicblock."));
|
||||
|
||||
// Command line option to turn on CFG dot dump after profile annotation.
|
||||
// Defined in Analysis/BlockFrequencyInfo.cpp: -pgo-view-counts
|
||||
extern cl::opt<PGOViewCountsType> PGOViewCounts;
|
||||
@ -425,7 +429,7 @@ public:
|
||||
private:
|
||||
bool runOnModule(Module &M) override {
|
||||
createProfileFileNameVar(M, InstrProfileOutput);
|
||||
createIRLevelProfileFlagVar(M, true);
|
||||
createIRLevelProfileFlagVar(M, /* IsCS */ true, PGOInstrumentEntry);
|
||||
return false;
|
||||
}
|
||||
std::string InstrProfileOutput;
|
||||
@ -528,6 +532,9 @@ private:
|
||||
// Is this is context-sensitive instrumentation.
|
||||
bool IsCS;
|
||||
|
||||
// If we instrument function entry BB by default.
|
||||
bool InstrumentFuncEntry;
|
||||
|
||||
// A map that stores the Comdat group in function F.
|
||||
std::unordered_multimap<Comdat *, GlobalValue *> &ComdatMembers;
|
||||
|
||||
@ -572,9 +579,11 @@ public:
|
||||
Function &Func, TargetLibraryInfo &TLI,
|
||||
std::unordered_multimap<Comdat *, GlobalValue *> &ComdatMembers,
|
||||
bool CreateGlobalVar = false, BranchProbabilityInfo *BPI = nullptr,
|
||||
BlockFrequencyInfo *BFI = nullptr, bool IsCS = false)
|
||||
BlockFrequencyInfo *BFI = nullptr, bool IsCS = false,
|
||||
bool InstrumentFuncEntry = true)
|
||||
: F(Func), IsCS(IsCS), ComdatMembers(ComdatMembers), VPC(Func, TLI),
|
||||
ValueSites(IPVK_Last + 1), SIVisitor(Func), MST(F, BPI, BFI) {
|
||||
ValueSites(IPVK_Last + 1), SIVisitor(Func),
|
||||
MST(F, InstrumentFuncEntry, BPI, BFI) {
|
||||
// This should be done before CFG hash computation.
|
||||
SIVisitor.countSelects(Func);
|
||||
ValueSites[IPVK_MemOPSize] = VPC.get(IPVK_MemOPSize);
|
||||
@ -845,8 +854,8 @@ static void instrumentOneFunc(
|
||||
// later in getInstrBB() to avoid invalidating it.
|
||||
SplitIndirectBrCriticalEdges(F, BPI, BFI);
|
||||
|
||||
FuncPGOInstrumentation<PGOEdge, BBInfo> FuncInfo(F, TLI, ComdatMembers, true,
|
||||
BPI, BFI, IsCS);
|
||||
FuncPGOInstrumentation<PGOEdge, BBInfo> FuncInfo(
|
||||
F, TLI, ComdatMembers, true, BPI, BFI, IsCS, PGOInstrumentEntry);
|
||||
std::vector<BasicBlock *> InstrumentBBs;
|
||||
FuncInfo.getInstrumentBBs(InstrumentBBs);
|
||||
unsigned NumCounters =
|
||||
@ -1004,9 +1013,10 @@ public:
|
||||
PGOUseFunc(Function &Func, Module *Modu, TargetLibraryInfo &TLI,
|
||||
std::unordered_multimap<Comdat *, GlobalValue *> &ComdatMembers,
|
||||
BranchProbabilityInfo *BPI, BlockFrequencyInfo *BFIin,
|
||||
ProfileSummaryInfo *PSI, bool IsCS)
|
||||
ProfileSummaryInfo *PSI, bool IsCS, bool InstrumentFuncEntry)
|
||||
: F(Func), M(Modu), BFI(BFIin), PSI(PSI),
|
||||
FuncInfo(Func, TLI, ComdatMembers, false, BPI, BFIin, IsCS),
|
||||
FuncInfo(Func, TLI, ComdatMembers, false, BPI, BFIin, IsCS,
|
||||
InstrumentFuncEntry),
|
||||
FreqAttr(FFA_Normal), IsCS(IsCS) {}
|
||||
|
||||
// Read counts for the instrumented BB from profile.
|
||||
@ -1514,7 +1524,7 @@ static bool InstrumentAllFunctions(
|
||||
// For the context-sensitve instrumentation, we should have a separated pass
|
||||
// (before LTO/ThinLTO linking) to create these variables.
|
||||
if (!IsCS)
|
||||
createIRLevelProfileFlagVar(M, /* IsCS */ false);
|
||||
createIRLevelProfileFlagVar(M, /* IsCS */ false, PGOInstrumentEntry);
|
||||
std::unordered_multimap<Comdat *, GlobalValue *> ComdatMembers;
|
||||
collectComdatMembers(M, ComdatMembers);
|
||||
|
||||
@ -1532,7 +1542,7 @@ static bool InstrumentAllFunctions(
|
||||
PreservedAnalyses
|
||||
PGOInstrumentationGenCreateVar::run(Module &M, ModuleAnalysisManager &AM) {
|
||||
createProfileFileNameVar(M, CSInstrName);
|
||||
createIRLevelProfileFlagVar(M, /* IsCS */ true);
|
||||
createIRLevelProfileFlagVar(M, /* IsCS */ true, PGOInstrumentEntry);
|
||||
return PreservedAnalyses::all();
|
||||
}
|
||||
|
||||
@ -1619,6 +1629,12 @@ static bool annotateAllFunctions(
|
||||
collectComdatMembers(M, ComdatMembers);
|
||||
std::vector<Function *> HotFunctions;
|
||||
std::vector<Function *> ColdFunctions;
|
||||
|
||||
// If the profile marked as always instrument the entry BB, do the
|
||||
// same. Note this can be overwritten by the internal option in CFGMST.h
|
||||
bool InstrumentFuncEntry = PGOReader->instrEntryBBEnabled();
|
||||
if (PGOInstrumentEntry.getNumOccurrences() > 0)
|
||||
InstrumentFuncEntry = PGOInstrumentEntry;
|
||||
for (auto &F : M) {
|
||||
if (F.isDeclaration())
|
||||
continue;
|
||||
@ -1628,7 +1644,8 @@ static bool annotateAllFunctions(
|
||||
// Split indirectbr critical edges here before computing the MST rather than
|
||||
// later in getInstrBB() to avoid invalidating it.
|
||||
SplitIndirectBrCriticalEdges(F, BPI, BFI);
|
||||
PGOUseFunc Func(F, &M, TLI, ComdatMembers, BPI, BFI, PSI, IsCS);
|
||||
PGOUseFunc Func(F, &M, TLI, ComdatMembers, BPI, BFI, PSI, IsCS,
|
||||
InstrumentFuncEntry);
|
||||
bool AllZeros = false;
|
||||
if (!Func.readCounters(PGOReader.get(), AllZeros))
|
||||
continue;
|
||||
|
9
test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
Normal file
9
test/Transforms/PGOProfile/Inputs/branch2_entry.proftext
Normal file
@ -0,0 +1,9 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
test_br_2
|
||||
29667547796
|
||||
2
|
||||
2
|
||||
1
|
||||
|
@ -0,0 +1,20 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
test_criticalEdge
|
||||
82323253069
|
||||
8
|
||||
7
|
||||
2
|
||||
1
|
||||
2
|
||||
0
|
||||
1
|
||||
2
|
||||
1
|
||||
|
||||
<stdin>:bar
|
||||
12884901887
|
||||
1
|
||||
7
|
||||
|
@ -1,5 +1,6 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
hot
|
||||
# Func Hash:
|
||||
12884901887
|
||||
|
13
test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
Normal file
13
test/Transforms/PGOProfile/Inputs/indirectbr_entry.proftext
Normal file
@ -0,0 +1,13 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
foo
|
||||
# Func Hash:
|
||||
47485104005
|
||||
# Num Counters:
|
||||
4
|
||||
# Counter Values:
|
||||
202
|
||||
20
|
||||
5
|
||||
63
|
30
test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
Normal file
30
test/Transforms/PGOProfile/Inputs/irreducible_entry.proftext
Normal file
@ -0,0 +1,30 @@
|
||||
:ir
|
||||
:entry_first
|
||||
_Z11irreducibleii
|
||||
# Func Hash:
|
||||
64451410787
|
||||
# Num Counters:
|
||||
6
|
||||
# Counter Values:
|
||||
1
|
||||
1000
|
||||
950
|
||||
100
|
||||
373
|
||||
0
|
||||
|
||||
_Z11irreduciblePh
|
||||
# Func Hash:
|
||||
104649601521
|
||||
# Num Counters:
|
||||
9
|
||||
# Counter Values:
|
||||
1
|
||||
100
|
||||
300
|
||||
99
|
||||
300
|
||||
201
|
||||
1
|
||||
0
|
||||
0
|
17
test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
Normal file
17
test/Transforms/PGOProfile/Inputs/landingpad_entry.proftext
Normal file
@ -0,0 +1,17 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
foo
|
||||
59130013419
|
||||
4
|
||||
5
|
||||
1
|
||||
2
|
||||
0
|
||||
|
||||
bar
|
||||
24868915205
|
||||
2
|
||||
3
|
||||
2
|
||||
|
9
test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
Normal file
9
test/Transforms/PGOProfile/Inputs/loop1_entry.proftext
Normal file
@ -0,0 +1,9 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
test_simple_for
|
||||
34137660316
|
||||
2
|
||||
4
|
||||
96
|
||||
|
10
test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
Normal file
10
test/Transforms/PGOProfile/Inputs/loop2_entry.proftext
Normal file
@ -0,0 +1,10 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
test_nested_for
|
||||
53929068288
|
||||
3
|
||||
6
|
||||
33
|
||||
10
|
||||
|
@ -0,0 +1,39 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
bar
|
||||
# Func Hash:
|
||||
29667547796
|
||||
# Num Counters:
|
||||
2
|
||||
# Counter Values:
|
||||
2000000
|
||||
1600332
|
||||
|
||||
baz
|
||||
# Func Hash:
|
||||
12884901887
|
||||
# Num Counters:
|
||||
1
|
||||
# Counter Values:
|
||||
399668
|
||||
|
||||
foo
|
||||
# Func Hash:
|
||||
29212902728
|
||||
# Num Counters:
|
||||
2
|
||||
# Counter Values:
|
||||
40803991
|
||||
1600332
|
||||
|
||||
main
|
||||
# Func Hash:
|
||||
41605652536
|
||||
# Num Counters:
|
||||
3
|
||||
# Counter Values:
|
||||
2000000
|
||||
2000
|
||||
1
|
||||
|
@ -0,0 +1,17 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
main
|
||||
# Func Hash:
|
||||
74054140268
|
||||
# Num Counters:
|
||||
7
|
||||
# Counter Values:
|
||||
1
|
||||
0
|
||||
0
|
||||
20000
|
||||
0
|
||||
0
|
||||
0
|
||||
|
@ -0,0 +1,17 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
main
|
||||
# Func Hash:
|
||||
74054140268
|
||||
# Num Counters:
|
||||
7
|
||||
# Counter Values:
|
||||
11889
|
||||
3973
|
||||
3970
|
||||
0
|
||||
8111
|
||||
1
|
||||
0
|
||||
|
@ -1,8 +1,9 @@
|
||||
:ir
|
||||
:entry_first
|
||||
test_br_2
|
||||
72057623705475732
|
||||
3
|
||||
4
|
||||
5
|
||||
1
|
||||
1
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
# IR level Instrumentation Flag
|
||||
:ir
|
||||
:entry_first
|
||||
foo
|
||||
# Func Hash:
|
||||
72057628175588252
|
||||
# Num Counters:
|
||||
3
|
||||
# Counter Values:
|
||||
800
|
||||
3
|
||||
800
|
||||
300
|
||||
|
11
test/Transforms/PGOProfile/Inputs/switch_entry.proftext
Normal file
11
test/Transforms/PGOProfile/Inputs/switch_entry.proftext
Normal file
@ -0,0 +1,11 @@
|
||||
# :ir is the flag to indicate this is IR level profile.
|
||||
:ir
|
||||
:entry_first
|
||||
test_switch
|
||||
46200943743
|
||||
4
|
||||
10
|
||||
5
|
||||
2
|
||||
3
|
||||
|
@ -1,8 +1,14 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/branch2.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/branch2_entry.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
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"
|
||||
|
||||
@ -13,7 +19,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||
define i32 @test_br_2(i32 %i) {
|
||||
entry:
|
||||
; GEN: entry:
|
||||
; GEN-NOT: llvm.instrprof.increment
|
||||
; NOTENTRY-NOT: llvm.instrprof.increment
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 29667547796, i32 2, i32 0)
|
||||
%cmp = icmp sgt i32 %i, 0
|
||||
br i1 %cmp, label %if.then, label %if.else
|
||||
; USE: br i1 %cmp, label %if.then, label %if.else
|
||||
@ -22,7 +29,8 @@ entry:
|
||||
|
||||
if.then:
|
||||
; GEN: if.then:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 29667547796, i32 2, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_2, i32 0, i32 0), i64 29667547796, i32 2, i32 0)
|
||||
; ENTRY-NOT: llvm.instrprof.increment
|
||||
%add = add nsw i32 %i, 2
|
||||
br label %if.end
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
; compilation for loops that exit to a catchswitch block. In this case, counters
|
||||
; do not get promoted out of the loop body.
|
||||
|
||||
; RUN: opt < %s -pgo-instr-gen -instrprof -do-counter-promotion=true -S | FileCheck %s
|
||||
; RUN: opt < %s -passes=pgo-instr-gen,instrprof -do-counter-promotion=true -S | FileCheck %s
|
||||
; RUN: opt < %s -pgo-instr-gen -instrprof -pgo-instrument-entry=false -do-counter-promotion=true -S | FileCheck %s --check-prefixes=CHECK,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen,instrprof -pgo-instrument-entry=false -do-counter-promotion=true -S | FileCheck %s --check-prefixes=CHECK,NOTENTRY
|
||||
; RUN: opt < %s -pgo-instr-gen -instrprof -pgo-instrument-entry=true -do-counter-promotion=true -S | FileCheck %s --check-prefixes=CHECK,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen,instrprof -pgo-instrument-entry=true -do-counter-promotion=true -S | FileCheck %s --check-prefixes=CHECK,ENTRY
|
||||
|
||||
; Source used to create test:
|
||||
;
|
||||
@ -36,9 +38,11 @@ for.cond: ; preds = %for.inc, %entry
|
||||
|
||||
for.body: ; preds = %for.cond
|
||||
; CHECK: for.body:
|
||||
; CHECK: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0)
|
||||
; NOTENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0)
|
||||
; TENTRY: %pgocount1 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
; CHECK: %1 = add i64 %pgocount1, 1
|
||||
; CHECK: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0)
|
||||
; NOTENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 0)
|
||||
; ENTRY: store i64 %1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
%idxprom = zext i32 %i.0 to i64
|
||||
%arrayidx = getelementptr inbounds [200 x i8], [200 x i8]* @"?buffer@@3PADA", i64 0, i64 %idxprom
|
||||
%0 = load i8, i8* %arrayidx, align 1
|
||||
@ -51,9 +55,11 @@ if.end: ; preds = %for.body
|
||||
|
||||
for.inc: ; preds = %if.end
|
||||
; CHECK: for.inc:
|
||||
; CHECK: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
; NOTENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
; ENTRY: %pgocount2 = load i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 2)
|
||||
; CHECK: %3 = add i64 %pgocount2, 1
|
||||
; CHECK: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
; NOTENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 1)
|
||||
; ENTRY: store i64 %3, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @"__profc_?run@@YAXH@Z", i64 0, i64 2)
|
||||
%inc = add nuw nsw i32 %i.0, 1
|
||||
br label %for.cond
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: llvm-profdata merge %S/Inputs/criticaledge.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
;
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: llvm-profdata merge %S/Inputs/criticaledge_entry.proftext -o %t2.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
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"
|
||||
|
||||
@ -14,7 +20,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||
define i32 @test_criticalEdge(i32 %i, i32 %j) {
|
||||
entry:
|
||||
; CHECK: entry:
|
||||
; GEN-NOT: call void @llvm.instrprof.increment
|
||||
; NOTENTRY-NOT: call void @llvm.instrprof.increment
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 0)
|
||||
switch i32 %i, label %sw.default [
|
||||
i32 1, label %sw.bb
|
||||
i32 2, label %sw.bb1
|
||||
@ -28,11 +35,13 @@ entry:
|
||||
; USE-SAME: !prof ![[BW_SWITCH:[0-9]+]]
|
||||
|
||||
; CHECK: entry.sw.bb2_crit_edge1:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 1)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 1)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 2)
|
||||
; CHECK: br label %sw.bb2
|
||||
|
||||
; CHECK: entry.sw.bb2_crit_edge:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 0)
|
||||
; TENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 1)
|
||||
; CHECK: br label %sw.bb2
|
||||
|
||||
sw.bb:
|
||||
@ -57,7 +66,8 @@ sw.bb2:
|
||||
|
||||
if.then:
|
||||
; GEN: if.then:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 2)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__profn_test_criticalEdge, i32 0, i32 0), i64 82323253069, i32 8, i32 2)
|
||||
; ENTRY-NOT: call void @llvm.instrprof.increment
|
||||
%call4 = call i32 @bar(i32 4)
|
||||
br label %return
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
; Test the profile summary for context sensitive PGO (CSPGO)
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/cspgo.proftext -o %t.profdata
|
||||
; RUN: opt < %s -O2 -disable-preinline -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S | FileCheck %s --check-prefix=PGOSUMMARY
|
||||
; RUN: opt < %s -O2 -disable-preinline -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S -cspgo-kind=cspgo-instr-use-pipeline| FileCheck %s --check-prefix=CSPGOSUMMARY
|
||||
; RUN: opt < %s -O2 -disable-preinline -pgo-instrument-entry=false -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S | FileCheck %s --check-prefix=PGOSUMMARY
|
||||
; RUN: opt < %s -O2 -disable-preinline -pgo-instrument-entry=false -pgo-kind=pgo-instr-use-pipeline -profile-file=%t.profdata -S -cspgo-kind=cspgo-instr-use-pipeline| FileCheck %s --check-prefix=CSPGOSUMMARY
|
||||
|
||||
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"
|
||||
|
@ -1,8 +1,13 @@
|
||||
; RUN: llvm-profdata merge %S/Inputs/indirectbr.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; New PM
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | opt -S -analyze -branch-prob | FileCheck %s --check-prefix=BRANCHPROB
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | opt -S -analyze -branch-prob | FileCheck %s --check-prefix=BRANCHPROB
|
||||
; RUN: llvm-profdata merge %S/Inputs/indirectbr_entry.proftext -o %t2.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; New PM
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | opt -S -analyze -branch-prob | FileCheck %s --check-prefix=BRANCHPROB
|
||||
|
||||
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"
|
||||
|
@ -1,6 +1,9 @@
|
||||
; RUN: llvm-profdata merge %S/Inputs/irreducible.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: llvm-profdata merge %S/Inputs/irreducible_entry.proftext -o %t2.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
|
||||
; GEN: $__llvm_profile_raw_version = comdat any
|
||||
|
||||
|
@ -1,8 +1,14 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/landingpad.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
;
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/landingpad_entry.proftext -o %t2.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S | FileCheck %s --check-prefix=USE
|
||||
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"
|
||||
|
||||
@ -46,7 +52,8 @@ declare void @__cxa_throw(i8*, i8*, i8*)
|
||||
define i32 @foo(i32 %i) personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
|
||||
entry:
|
||||
; GEN: entry:
|
||||
; GEN-NOT: call void @llvm.instrprof.increment
|
||||
; NOTENTRY-NOT: call void @llvm.instrprof.increment
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 0)
|
||||
%rem = srem i32 %i, 2
|
||||
%tobool = icmp ne i32 %rem, 0
|
||||
br i1 %tobool, label %if.then, label %if.end
|
||||
@ -102,7 +109,8 @@ try.cont:
|
||||
|
||||
if.end:
|
||||
; GEN: if.end:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__profn_foo, i32 0, i32 0), i64 59130013419, i32 4, i32 0)
|
||||
; ENTRY-NOT: call void @llvm.instrprof.increment
|
||||
%tmp8 = load i32, i32* @val, align 4
|
||||
%add = add nsw i32 %tmp8, %i
|
||||
store i32 %add, i32* @val, align 4
|
||||
|
@ -1,8 +1,14 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/loop1.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/loop1_entry.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
|
||||
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"
|
||||
|
||||
@ -13,7 +19,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||
define i32 @test_simple_for(i32 %n) {
|
||||
entry:
|
||||
; GEN: entry:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 1)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 1)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 0)
|
||||
br label %for.cond
|
||||
|
||||
for.cond:
|
||||
@ -35,7 +42,8 @@ for.body:
|
||||
|
||||
for.inc:
|
||||
; GEN: for.inc:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 0)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_simple_for, i32 0, i32 0), i64 34137660316, i32 2, i32 1)
|
||||
%inc1 = add nsw i32 %i, 1
|
||||
br label %for.cond
|
||||
|
||||
|
@ -1,8 +1,13 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/loop2.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/loop2_entry.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
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"
|
||||
|
||||
@ -13,7 +18,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||
define i32 @test_nested_for(i32 %r, i32 %s) {
|
||||
entry:
|
||||
; GEN: entry:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 2)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 2)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 0)
|
||||
br label %for.cond.outer
|
||||
|
||||
for.cond.outer:
|
||||
@ -49,7 +55,8 @@ for.body.inner:
|
||||
|
||||
for.inc.inner:
|
||||
; GEN: for.inc.inner:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 0)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 1)
|
||||
%inc.1 = add nsw i32 %j.0, 1
|
||||
br label %for.cond.inner
|
||||
|
||||
@ -59,7 +66,8 @@ for.end.inner:
|
||||
|
||||
for.inc.outer:
|
||||
; GEN: for.inc.outer:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 1)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 1)
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__profn_test_nested_for, i32 0, i32 0), i64 53929068288, i32 3, i32 2)
|
||||
%inc.2 = add nsw i32 %i.0, 1
|
||||
br label %for.cond.outer
|
||||
|
||||
|
@ -1,20 +1,28 @@
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-branch.proftext -o %t.profdata
|
||||
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-branch_entry.proftext -o %t2.profdata
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; WARNING-DAG: warning: <unknown>:0:0: 19.98%
|
||||
; WARNING-NOT: remark: <unknown>:0:0: Potential performance regression from use of the llvm.expect intrinsic: Annotation was correct on 19.98% (399668 / 2000000) of profiled executions.
|
||||
|
||||
|
@ -1,19 +1,28 @@
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-branch.proftext -o %t.profdata
|
||||
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-branch_entry.proftext -o %t2.profdata
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; WARNING-DAG: warning: misexpect-branch.c:22:0: 19.98%
|
||||
; WARNING-NOT: remark: misexpect-branch.c:22:0: Potential performance regression from use of the llvm.expect intrinsic: Annotation was correct on 19.98% (399668 / 2000000) of profiled executions.
|
||||
|
@ -1,16 +1,15 @@
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-switch.proftext -o %t.profdata
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -lower-expect -pgo-instrument-entry=false -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instrument-entry=false -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instrument-entry=false -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instrument-entry=false -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; WARNING-DAG: warning: <unknown>:0:0: 0.00%
|
||||
; WARNING-NOT: remark: <unknown>:0:0: Potential performance regression from use of the llvm.expect intrinsic: Annotation was correct on 0.00% (0 / 27943) of profiled executions.
|
||||
@ -32,7 +31,6 @@
|
||||
; CHECK-DAG: !{!"misexpect", i64 0, i64 2000, i64 1}
|
||||
|
||||
|
||||
|
||||
; ModuleID = 'misexpect-switch.c'
|
||||
source_filename = "misexpect-switch.c"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
@ -1,21 +1,36 @@
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-switch.proftext -o %t.profdata
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-switch-correct.proftext -o %t.c.profdata
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-test-profile-file=%t.c.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-test-profile-file=%t.c.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.c.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=false -pgo-test-profile-file=%t.c.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-switch_entry.proftext -o %t2.profdata
|
||||
; RUN: llvm-profdata merge %S/Inputs/misexpect-switch-correct_entry.proftext -o %t2.c.profdata
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; New PM
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -S 2>&1 | FileCheck %s --check-prefix=WARNING
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=REMARK
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=BOTH
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.profdata -S 2>&1 | FileCheck %s --check-prefix=DISABLED
|
||||
|
||||
; RUN: opt < %s -lower-expect -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t2.c.profdata -S -pgo-warn-misexpect -pass-remarks=misexpect 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
; RUN: opt < %s -passes="function(lower-expect),pgo-instr-use" -pgo-instrument-entry=true -pgo-test-profile-file=%t2.c.profdata -pgo-warn-misexpect -pass-remarks=misexpect -S 2>&1 | FileCheck %s --check-prefix=CORRECT
|
||||
; WARNING-DAG: warning: misexpect-switch.c:26:5: 0.00%
|
||||
; WARNING-NOT: remark: misexpect-switch.c:26:5: Potential performance regression from use of the llvm.expect intrinsic: Annotation was correct on 0.00% (0 / 8112) of profiled executions.
|
||||
|
||||
@ -35,8 +50,6 @@
|
||||
; CORRECT-NOT: remark: {{.*}}
|
||||
; CHECK-DAG: !{!"misexpect", i64 0, i64 2000, i64 1}
|
||||
|
||||
|
||||
|
||||
; ModuleID = 'misexpect-switch.c'
|
||||
source_filename = "misexpect-switch.c"
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
@ -1,8 +1,13 @@
|
||||
; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=false -S | FileCheck %s --check-prefixes=GEN,NOTENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/switch.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=false -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: opt < %s -passes=pgo-instr-gen -pgo-instrument-entry=true -S | FileCheck %s --check-prefixes=GEN,ENTRY
|
||||
; RUN: llvm-profdata merge %S/Inputs/switch_entry.proftext -o %t.profdata
|
||||
; RUN: opt < %s -pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
; RUN: opt < %s -passes=pgo-instr-use -pgo-instrument-entry=true -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE
|
||||
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"
|
||||
|
||||
@ -13,7 +18,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||
define void @test_switch(i32 %i) {
|
||||
entry:
|
||||
; GEN: entry:
|
||||
; GEN-NOT: call void @llvm.instrprof.increment
|
||||
; NOTENTRY-NOT: call void @llvm.instrprof.increment
|
||||
; ENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 0)
|
||||
switch i32 %i, label %sw.default [
|
||||
i32 1, label %sw.bb
|
||||
i32 2, label %sw.bb1
|
||||
@ -30,7 +36,8 @@ sw.bb:
|
||||
|
||||
sw.bb1:
|
||||
; GEN: sw.bb1:
|
||||
; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 0)
|
||||
; NOTENTRY: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__profn_test_switch, i32 0, i32 0), i64 46200943743, i32 4, i32 0)
|
||||
; ENTRY-NOT: call void @llvm.instrprof.increment
|
||||
br label %sw.epilog
|
||||
|
||||
sw.bb2:
|
||||
|
@ -3,7 +3,7 @@
|
||||
; RUN: opt -module-summary %s -o %t1.bc
|
||||
; RUN: opt -module-summary %S/Inputs/thinlto_cspgo_bar_use.ll -o %t2.bc
|
||||
; RUN: llvm-profdata merge %S/Inputs/thinlto_cs.proftext -o %t3.profdata
|
||||
; RUN: llvm-lto2 run -lto-cspgo-profile-file=%t3.profdata -save-temps -o %t %t1.bc %t2.bc \
|
||||
; RUN: llvm-lto2 run -lto-cspgo-profile-file=%t3.profdata -pgo-instrument-entry=false -save-temps -o %t %t1.bc %t2.bc \
|
||||
; RUN: -r=%t1.bc,foo,pl \
|
||||
; RUN: -r=%t1.bc,bar,l \
|
||||
; RUN: -r=%t1.bc,main,plx \
|
||||
|
@ -0,0 +1,8 @@
|
||||
:entry_first
|
||||
:ir
|
||||
foo
|
||||
29667547796
|
||||
2
|
||||
100
|
||||
90
|
||||
|
@ -0,0 +1,8 @@
|
||||
:ir
|
||||
:not_entry_first
|
||||
foo
|
||||
29667547796
|
||||
2
|
||||
100
|
||||
90
|
||||
|
10
test/tools/llvm-profdata/Inputs/header-directives-3.proftext
Normal file
10
test/tools/llvm-profdata/Inputs/header-directives-3.proftext
Normal file
@ -0,0 +1,10 @@
|
||||
:not_entry_first
|
||||
:entry_first
|
||||
:fe
|
||||
:ir
|
||||
foo
|
||||
29667547796
|
||||
2
|
||||
100
|
||||
90
|
||||
|
10
test/tools/llvm-profdata/header-directives.test
Normal file
10
test/tools/llvm-profdata/header-directives.test
Normal file
@ -0,0 +1,10 @@
|
||||
RUN: llvm-profdata show %p/Inputs/header-directives-1.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
|
||||
RUN: llvm-profdata show %p/Inputs/header-directives-2.proftext -o - | FileCheck %s --check-prefixes=NOTENTRYFIRST,CHECK
|
||||
RUN: llvm-profdata show %p/Inputs/header-directives-3.proftext -o - | FileCheck %s --check-prefixes=ENTRYFIRST,CHECK
|
||||
|
||||
ENTRYFIRST: Instrumentation level: IR entry_first = 1
|
||||
NOTENTRYFIRST: Instrumentation level: IR entry_first = 0
|
||||
CHECK: Total functions: 1
|
||||
CHECK: Maximum function count: 100
|
||||
CHECK: Maximum internal block count: 90
|
||||
|
@ -251,6 +251,7 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper,
|
||||
Filename);
|
||||
return;
|
||||
}
|
||||
WC->Writer.setInstrEntryBBEnabled(Reader->instrEntryBBEnabled());
|
||||
|
||||
for (auto &I : *Reader) {
|
||||
if (Remapper)
|
||||
@ -977,8 +978,11 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
|
||||
if (TextFormat)
|
||||
return 0;
|
||||
std::unique_ptr<ProfileSummary> PS(Builder.getSummary());
|
||||
OS << "Instrumentation level: "
|
||||
<< (Reader->isIRLevelProfile() ? "IR" : "Front-end") << "\n";
|
||||
bool IsIR = Reader->isIRLevelProfile();
|
||||
OS << "Instrumentation level: " << (IsIR ? "IR" : "Front-end");
|
||||
if (IsIR)
|
||||
OS << " entry_first = " << Reader->instrEntryBBEnabled();
|
||||
OS << "\n";
|
||||
if (ShowAllFunctions || !ShowFunction.empty())
|
||||
OS << "Functions shown: " << ShownFunctions << "\n";
|
||||
OS << "Total functions: " << PS->getNumFunctions() << "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user