Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sanitizer] Parse weighted sanitizer args and -fsanitize-skip-hot-cutoff #121619

Merged
merged 52 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ca1fabc
[sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot
thurstond Jan 4, 2025
7701659
clang-format
thurstond Jan 4, 2025
ade9e63
Update flag description
thurstond Jan 6, 2025
6e20cf8
Plumb values through CodeGen
thurstond Jan 6, 2025
cc3a2ac
clang-format
thurstond Jan 6, 2025
9a2a0e8
using SanitizerMaskWeights = std::array<float, SanitizerKind::SO_Count>
thurstond Jan 6, 2025
bfa57c6
clang-format
thurstond Jan 6, 2025
346adc1
Rename Weights to Cutoffs
thurstond Jan 6, 2025
66dbc49
Limit changes to Driver
thurstond Jan 6, 2025
6f5e714
Reorder to make comment more logical
thurstond Jan 7, 2025
fc623f2
Refactor into parseArgCutoffs; update comment
thurstond Jan 7, 2025
00d135e
Remove unnecessary suppression
thurstond Jan 7, 2025
4d97bed
clang-format
thurstond Jan 7, 2025
1f528c5
Change Cutoffs* to Cutoffs&
thurstond Jan 7, 2025
071e10e
Remove SanitizerMask TopHot
thurstond Jan 7, 2025
c970179
Rely on RVO
thurstond Jan 7, 2025
b2bb1d6
Fix uninitialized memory
thurstond Jan 7, 2025
369e6c8
clang-format
thurstond Jan 7, 2025
c6d4e73
Allow passing -fno-sanitize-top-hot=undefined=0.0. Add more tests.
thurstond Jan 7, 2025
85b898c
Check cutoffs in parsing. Update tests.
thurstond Jan 7, 2025
6cd43bb
Change cutoffs parser to return an empty SanitizerMask (Cutoffs becom…
thurstond Jan 7, 2025
c4b6a68
Simplify parseNoSanitizeHotArgs by not relying on parseSanitizeArgs
thurstond Jan 7, 2025
57d6c59
Change parseArgCutoffs to void return
thurstond Jan 7, 2025
56ba349
Convert SanitizerMaskCutoffs to struct
thurstond Jan 7, 2025
2298f93
Omit redundant initialization
thurstond Jan 7, 2025
a5ff144
Remove unnecessary braces
thurstond Jan 7, 2025
46e90e5
Rename 'data' to 'cutoffs'
thurstond Jan 7, 2025
58550e9
Improve comment
vitalybuka Jan 7, 2025
b2f0e5d
Make SanitizerMaskCutoffs class
vitalybuka Jan 7, 2025
be0f4e8
Remove unrelated change
vitalybuka Jan 7, 2025
a21c77b
Simplify parseSanitizerWeightedValue
vitalybuka Jan 7, 2025
27fe651
Fix clamp call
vitalybuka Jan 7, 2025
45a9fa5
Whitespace
thurstond Jan 7, 2025
5ab2a2b
Fix case in comment
vitalybuka Jan 7, 2025
a9c8d58
Hide clear logic into SanitizerMaskCutoffs
vitalybuka Jan 8, 2025
b668bcb
use string::empty
vitalybuka Jan 8, 2025
9321def
Return SanitizerMaskCutoffs from parseNoSanitizeHotArgs by value
vitalybuka Jan 8, 2025
d39638d
Extract ::set
vitalybuka Jan 8, 2025
99cfdb2
return float by value
vitalybuka Jan 8, 2025
58c752b
Updates
vitalybuka Jan 8, 2025
f27eb85
Include
vitalybuka Jan 8, 2025
1aed608
Fix clamp for double
vitalybuka Jan 8, 2025
b82e48d
Format
vitalybuka Jan 8, 2025
a8e79ce
Claim matched arguments
thurstond Jan 8, 2025
d3fa04d
Change test to use -Werror and not check for error messages, per Fang…
thurstond Jan 8, 2025
55f42e7
Format
vitalybuka Jan 8, 2025
d8a3696
This reverts part of commit b82e48d83663afead2b5b0ed4c5f2fb2b32683ad.
vitalybuka Jan 8, 2025
17ecca4
rtrim('0')
vitalybuka Jan 8, 2025
b43d513
clang-format
vitalybuka Jan 8, 2025
caa4964
Rename -fno-sanitize-top-hot to -fsanitize-skip-hot-cutoff
thurstond Jan 9, 2025
9837912
clang-format
thurstond Jan 9, 2025
10e0a55
++clang
thurstond Jan 10, 2025
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
Prev Previous commit
Next Next commit
Fix uninitialized memory
  • Loading branch information
thurstond committed Jan 7, 2025
commit b2bb1d6d34afce14de2587c39517c20f1f732aec
3 changes: 3 additions & 0 deletions clang/lib/Driver/SanitizerArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,9 @@ SanitizerMask parseArgCutoffs(const Driver &D, const llvm::opt::Arg *A,

SanitizerMask Kind;
for (unsigned int i = 0; i < SanitizerKind::SO_Count; i++) {
// Invoking bitPosToMask repeatedly is inefficient: we could simply
// repeatedly set the LSB then left-shift; however, we assume the
// compiler will optimize this (in any case, the runtime is negligible).
if (Cutoffs[i])
Kind |= SanitizerMask::bitPosToMask(i);
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ static SmallVector<StringRef, 4> serializeSanitizerKinds(SanitizerSet S) {
static SanitizerMaskCutoffs parseSanitizerWeightedKinds(
StringRef FlagName, const std::vector<std::string> &Sanitizers,
DiagnosticsEngine &Diags) {
SanitizerMaskCutoffs Cutoffs;
SanitizerMaskCutoffs Cutoffs = {0};
for (const auto &Sanitizer : Sanitizers) {
if (!parseSanitizerWeightedValue(Sanitizer, /*AllowGroups=*/false, Cutoffs))
Diags.Report(diag::err_drv_invalid_value) << FlagName << Sanitizer;
Expand Down