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

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler-rt/include/profile/InstrProfData.inc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \
NameValue.size()))
#endif
#ifdef COVMAP_V2_OR_V3
COVMAP_FUNC_RECORD(const int64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \
COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \
llvm::ConstantInt::get( \
llvm::Type::getInt64Ty(Ctx), NameHash))
#endif
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class CounterMappingContext {

/// Return the number of times that a region of code associated with this
/// counter was executed.
Expected<int64_t> evaluate(const Counter &C) const;
Expected<uint64_t> evaluate(const Counter &C) const;

unsigned getMaxCounterID(const Counter &C) const;
};
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/InstrProfData.inc
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ COVMAP_FUNC_RECORD(const uint32_t, llvm::Type::getInt32Ty(Ctx), NameSize, \
NameValue.size()))
#endif
#ifdef COVMAP_V2_OR_V3
COVMAP_FUNC_RECORD(const int64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \
COVMAP_FUNC_RECORD(const uint64_t, llvm::Type::getInt64Ty(Ctx), NameRef, \
llvm::ConstantInt::get( \
llvm::Type::getInt64Ty(Ctx), NameHash))
#endif
Expand Down
24 changes: 12 additions & 12 deletions llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,18 @@ void CounterMappingContext::dump(const Counter &C, raw_ostream &OS) const {
}
if (CounterValues.empty())
return;
Expected<int64_t> Value = evaluate(C);
Expected<uint64_t> Value = evaluate(C);
if (auto E = Value.takeError()) {
consumeError(std::move(E));
return;
}
OS << '[' << *Value << ']';
}

Expected<int64_t> CounterMappingContext::evaluate(const Counter &C) const {
Expected<uint64_t> CounterMappingContext::evaluate(const Counter &C) const {
struct StackElem {
Counter ICounter;
int64_t LHS = 0;
uint64_t LHS = 0;
enum {
KNeverVisited = 0,
KVisitedOnce = 1,
Expand All @@ -179,7 +179,7 @@ Expected<int64_t> CounterMappingContext::evaluate(const Counter &C) const {
std::stack<StackElem> CounterStack;
CounterStack.push({C});

int64_t LastPoppedValue;
uint64_t LastPoppedValue;

while (!CounterStack.empty()) {
StackElem &Current = CounterStack.top();
Expand Down Expand Up @@ -207,8 +207,8 @@ Expected<int64_t> CounterMappingContext::evaluate(const Counter &C) const {
CounterStack.push(StackElem{E.RHS});
Current.VisitCount = StackElem::KVisitedTwice;
} else {
int64_t LHS = Current.LHS;
int64_t RHS = LastPoppedValue;
uint64_t LHS = Current.LHS;
uint64_t RHS = LastPoppedValue;
LastPoppedValue =
E.Kind == CounterExpression::Subtract ? LHS - RHS : LHS + RHS;
CounterStack.pop();
Expand All @@ -224,7 +224,7 @@ Expected<int64_t> CounterMappingContext::evaluate(const Counter &C) const {
unsigned CounterMappingContext::getMaxCounterID(const Counter &C) const {
struct StackElem {
Counter ICounter;
int64_t LHS = 0;
uint64_t LHS = 0;
enum {
KNeverVisited = 0,
KVisitedOnce = 1,
Expand All @@ -235,7 +235,7 @@ unsigned CounterMappingContext::getMaxCounterID(const Counter &C) const {
std::stack<StackElem> CounterStack;
CounterStack.push({C});

int64_t LastPoppedValue;
uint64_t LastPoppedValue;

while (!CounterStack.empty()) {
StackElem &Current = CounterStack.top();
Expand Down Expand Up @@ -263,8 +263,8 @@ unsigned CounterMappingContext::getMaxCounterID(const Counter &C) const {
CounterStack.push(StackElem{E.RHS});
Current.VisitCount = StackElem::KVisitedTwice;
} else {
int64_t LHS = Current.LHS;
int64_t RHS = LastPoppedValue;
uint64_t LHS = Current.LHS;
uint64_t RHS = LastPoppedValue;
LastPoppedValue = std::max(LHS, RHS);
CounterStack.pop();
}
Expand Down Expand Up @@ -345,12 +345,12 @@ Error CoverageMapping::loadFunctionRecord(

FunctionRecord Function(OrigFuncName, Record.Filenames);
for (const auto &Region : Record.MappingRegions) {
Expected<int64_t> ExecutionCount = Ctx.evaluate(Region.Count);
Expected<uint64_t> ExecutionCount = Ctx.evaluate(Region.Count);
if (auto E = ExecutionCount.takeError()) {
consumeError(std::move(E));
return Error::success();
}
Expected<int64_t> AltExecutionCount = Ctx.evaluate(Region.FalseCount);
Expected<uint64_t> AltExecutionCount = Ctx.evaluate(Region.FalseCount);
if (auto E = AltExecutionCount.takeError()) {
consumeError(std::move(E));
return Error::success();
Expand Down