[PATCH] D131935: [clang][llvm][NFC] Change misexpect's tolerance option to be 32-bit
Paul Kirth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 17 07:39:16 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG656c5d652ce1: [clang][llvm][NFC] Change misexpect's tolerance option to be 32-bit (authored by paulkirth).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131935/new/
https://reviews.llvm.org/D131935
Files:
clang/include/clang/Basic/CodeGenOptions.h
clang/lib/Frontend/CompilerInvocation.cpp
llvm/include/llvm/IR/LLVMContext.h
llvm/lib/IR/LLVMContext.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/Transforms/Utils/MisExpect.cpp
Index: llvm/lib/Transforms/Utils/MisExpect.cpp
===================================================================
--- llvm/lib/Transforms/Utils/MisExpect.cpp
+++ llvm/lib/Transforms/Utils/MisExpect.cpp
@@ -58,7 +58,7 @@
cl::desc("Use this option to turn on/off "
"warnings about incorrect usage of llvm.expect intrinsics."));
-static cl::opt<unsigned> MisExpectTolerance(
+static cl::opt<uint32_t> MisExpectTolerance(
"misexpect-tolerance", cl::init(0),
cl::desc("Prevents emiting diagnostics when profile counts are "
"within N% of the threshold.."));
@@ -72,7 +72,7 @@
}
uint64_t getMisExpectTolerance(LLVMContext &Ctx) {
- return std::max(static_cast<uint64_t>(MisExpectTolerance),
+ return std::max(static_cast<uint32_t>(MisExpectTolerance),
Ctx.getDiagnosticsMisExpectTolerance());
}
Index: llvm/lib/IR/LLVMContextImpl.h
===================================================================
--- llvm/lib/IR/LLVMContextImpl.h
+++ llvm/lib/IR/LLVMContextImpl.h
@@ -1387,8 +1387,8 @@
Optional<uint64_t> DiagnosticsHotnessThreshold = 0;
/// The percentage of difference between profiling branch weights and
- // llvm.expect branch weights to tolerate when emiting MisExpect diagnostics
- Optional<uint64_t> DiagnosticsMisExpectTolerance = 0;
+ /// llvm.expect branch weights to tolerate when emiting MisExpect diagnostics
+ Optional<uint32_t> DiagnosticsMisExpectTolerance = 0;
bool MisExpectWarningRequested = false;
/// The specialized remark streamer used by LLVM's OptimizationRemarkEmitter.
Index: llvm/lib/IR/LLVMContext.cpp
===================================================================
--- llvm/lib/IR/LLVMContext.cpp
+++ llvm/lib/IR/LLVMContext.cpp
@@ -148,10 +148,10 @@
return pImpl->DiagnosticsHotnessThreshold.value_or(UINT64_MAX);
}
void LLVMContext::setDiagnosticsMisExpectTolerance(
- Optional<uint64_t> Tolerance) {
+ Optional<uint32_t> Tolerance) {
pImpl->DiagnosticsMisExpectTolerance = Tolerance;
}
-uint64_t LLVMContext::getDiagnosticsMisExpectTolerance() const {
+uint32_t LLVMContext::getDiagnosticsMisExpectTolerance() const {
return pImpl->DiagnosticsMisExpectTolerance.value_or(0);
}
Index: llvm/include/llvm/IR/LLVMContext.h
===================================================================
--- llvm/include/llvm/IR/LLVMContext.h
+++ llvm/include/llvm/IR/LLVMContext.h
@@ -204,8 +204,8 @@
bool getMisExpectWarningRequested() const;
void setMisExpectWarningRequested(bool Requested);
- void setDiagnosticsMisExpectTolerance(Optional<uint64_t> Tolerance);
- uint64_t getDiagnosticsMisExpectTolerance() const;
+ void setDiagnosticsMisExpectTolerance(Optional<uint32_t> Tolerance);
+ uint32_t getDiagnosticsMisExpectTolerance() const;
/// Return the minimum hotness value a diagnostic would need in order
/// to be included in optimization diagnostics.
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -113,8 +113,8 @@
// Parse misexpect tolerance argument value.
// Valid option values are integers in the range [0, 100)
-inline Expected<Optional<uint64_t>> parseToleranceOption(StringRef Arg) {
- int64_t Val;
+inline Expected<Optional<uint32_t>> parseToleranceOption(StringRef Arg) {
+ uint32_t Val;
if (Arg.getAsInteger(10, Val))
return llvm::createStringError(llvm::inconvertibleErrorCode(),
"Not an integer: %s", Arg.data());
Index: clang/include/clang/Basic/CodeGenOptions.h
===================================================================
--- clang/include/clang/Basic/CodeGenOptions.h
+++ clang/include/clang/Basic/CodeGenOptions.h
@@ -424,7 +424,7 @@
/// The maximum percentage profiling weights can deviate from the expected
/// values in order to be included in misexpect diagnostics.
- Optional<uint64_t> DiagnosticsMisExpectTolerance = 0;
+ Optional<uint32_t> DiagnosticsMisExpectTolerance = 0;
public:
// Define accessors/mutators for code generation options of enumeration type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131935.453280.patch
Type: text/x-patch
Size: 4190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220817/2f7cd3a1/attachment.bin>
More information about the llvm-commits
mailing list