Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class PGOMemOPSizeOpt : public PassInfoMixin<PGOMemOPSizeOpt> {
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &MAM);
};

LLVM_ABI void setProfMetadata(Module *M, Instruction *TI,
ArrayRef<uint64_t> EdgeCounts, uint64_t MaxCount);
LLVM_ABI void setProfMetadata(Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
uint64_t MaxCount);

LLVM_ABI void setIrrLoopHeaderMetadata(Module *M, Instruction *TI,
uint64_t Count);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Instrumentation/PGOCtxProfFlattening.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void assignProfileData(Function &F, ArrayRef<uint64_t> RawCounters) {
uint64_t TrueCount, FalseCount = 0;
if (!PA.getSelectInstrProfile(*SI, TrueCount, FalseCount))
continue;
setProfMetadata(F.getParent(), SI, {TrueCount, FalseCount},
setProfMetadata(SI, {TrueCount, FalseCount},
std::max(TrueCount, FalseCount));
}
if (succ_size(&BB) < 2)
Expand All @@ -67,7 +67,7 @@ void assignProfileData(Function &F, ArrayRef<uint64_t> RawCounters) {
if (!PA.getOutgoingBranchWeights(BB, ProfileHolder, MaxCount))
continue;
assert(MaxCount > 0);
setProfMetadata(F.getParent(), BB.getTerminator(), ProfileHolder, MaxCount);
setProfMetadata(BB.getTerminator(), ProfileHolder, MaxCount);
}
}

Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ void PGOUseFunc::setBranchWeights() {
}

if (MaxCount)
setProfMetadata(M, TI, EdgeCounts, MaxCount);
setProfMetadata(TI, EdgeCounts, MaxCount);
else {
// A zero MaxCount can come about when we have a BB with a positive
// count, and whose successor blocks all have 0 count. This can happen
Expand Down Expand Up @@ -1801,7 +1801,7 @@ void SelectInstVisitor::annotateOneSelectInst(SelectInst &SI) {
SCounts[1] = (TotalCount > SCounts[0] ? TotalCount - SCounts[0] : 0);
uint64_t MaxCount = std::max(SCounts[0], SCounts[1]);
if (MaxCount)
setProfMetadata(F.getParent(), &SI, SCounts, MaxCount);
setProfMetadata(&SI, SCounts, MaxCount);
}

void SelectInstVisitor::visitSelectInst(SelectInst &SI) {
Expand Down Expand Up @@ -2407,8 +2407,8 @@ static std::string getSimpleNodeName(const BasicBlock *Node) {
return SimpleNodeName;
}

void llvm::setProfMetadata(Module *M, Instruction *TI,
ArrayRef<uint64_t> EdgeCounts, uint64_t MaxCount) {
void llvm::setProfMetadata(Instruction *TI, ArrayRef<uint64_t> EdgeCounts,
uint64_t MaxCount) {
assert(MaxCount > 0 && "Bad max count");
uint64_t Scale = calculateCountScale(MaxCount);
SmallVector<unsigned, 4> Weights;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ bool MemOPSizeOpt::perform(MemOp MO) {
Updates.clear();

if (MaxCount)
setProfMetadata(Func.getParent(), SI, CaseCounts, MaxCount);
setProfMetadata(SI, CaseCounts, MaxCount);

LLVM_DEBUG(dbgs() << *BB << "\n");
LLVM_DEBUG(dbgs() << *DefaultBB << "\n");
Expand Down