[clang] [llvm] Remove -bounds-checking-unique-traps (replace with -fno-sanitize-merge=local-bounds) (PR #120682)

2024-12-19 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/120682 -fno-sanitize-merge (introduced in #120511) combines the functionality of -ubsan-unique-traps and -bounds-checking-unique-traps, while allowing fine-grained control of which UBSan checks to prevent merging. #

[clang] [Driver] Warn when using msan on Android (PR #122540)

2025-01-11 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/122540 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-08 Thread Thurston Dang via cfe-commits
@@ -1154,3 +1154,56 @@ // RUN: not %clang --target=x86_64-linux-gnu -fsanitize=realtime,undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-REALTIME-UBSAN // CHECK-REALTIME-UBSAN: error: invalid argument '-fsanitize=realtime' not allowed with '-fsanitize=undefined' +

[clang] [sanitizer] Parse weighted sanitizer args and -fsanitize-skip-hot-cutoff (PR #121619)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/121619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Parse weighted sanitizer args and -fsanitize-skip-hot-cutoff (PR #121619)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/121619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Parse weighted sanitizer args and -fsanitize-skip-hot-cutoff (PR #121619)

2025-01-09 Thread Thurston Dang via cfe-commits
@@ -14,10 +14,35 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/Format.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/raw_ostream.h" +#include +#include using namespace clang;

[clang] [nfc][ubsan] Use O1 in test to remove more unrelated stuff (PR #122408)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/122408 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/122392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/122392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/122392 The `Checked` parameter of `CodeGenFunction::EmitCheck` is of type `ArrayRef>`. In the general case, SanitizerMask can denote that zero or more sanitizers are enabled, but I believe (from tests and inspectin

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/122392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/122392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [nfc][BoundsChecking] Refactor BoundsCheckingOptions (PR #122346)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/122346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-09 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/121619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Warn when using msan on Android (PR #122540)

2025-01-11 Thread Thurston Dang via cfe-commits
thurstond wrote: > these checks into Toolchains/Linux.cpp so it triggers that code: IMO adding the Android msan check into Toolchains/Linux.cpp would be cleaner because it's: 1) only a 1 or 2 line change (compared with the current ~10 lines) 2) this file handles all the broad compatibility chec

[clang] [llvm] Reapply "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833) (PR #122994)

2025-01-22 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/122994 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [NFC][modules] Create objects on the stack (PR #124034)

2025-01-22 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/124034 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reapply "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833) (PR #122994)

2025-01-22 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/122994 >From afc18adfbc4671cd39356abd0945eae057b6ad28 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Tue, 14 Jan 2025 19:13:51 + Subject: [PATCH 1/3] Reapply "[sanitizer][NFCI] Add Options parameter to Lower

[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

2025-01-23 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

2025-01-23 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/124211 This passes through the values of -fsanitize-skip-hot-cutoff (introduced patch in https://github.com/llvm/llvm-project/pull/121619) to the LowerAllowCheckPass, via the Options parameter (introduced in https:

[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

2025-01-26 Thread Thurston Dang via cfe-commits
@@ -828,11 +828,34 @@ parseLowerAllowCheckPassOptions(StringRef Params) { StringRef ParamName; std::tie(ParamName, Params) = Params.split(';'); -return make_error( -formatv("invalid LowerAllowCheck pass parameter '{0}' ", ParamName) -.str(), -

[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

2025-01-26 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124211 >From 5d1944f522152a7356d8e8147d3b3c5939c32526 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/5] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to Lower

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
thurstond wrote: > Lets move clang part into a new PR? I've removed the clang part. Separate PR coming soon (tm). https://github.com/llvm/llvm-project/pull/124211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/m

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -108,14 +108,17 @@ static Value *getBoundsCheckCond(Value *Ptr, Value *InstVal, return Or; } -static CallInst *InsertTrap(BuilderTy &IRB, bool DebugTrapBB) { +static CallInst *InsertTrap(BuilderTy &IRB, bool DebugTrapBB, thurstond wrote: Done (https://g

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -107,7 +108,18 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, case Intrinsic::allow_runtime_check: { ++NumChecksTotal; -bool ToRemove = ShouldRemove(BB); +bool ToRemove = ShouldRemoveRandom(); + +unsigned i

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -81,21 +83,20 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, return *Rng; }; - auto ShouldRemoveHot = [&](const BasicBlock &BB) { -return HotPercentileCutoff.getNumOccurrences() && PSI && - PSI->isHotCountNthPercentile( -

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -81,21 +83,20 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, return *Rng; }; - auto ShouldRemoveHot = [&](const BasicBlock &BB) { -return HotPercentileCutoff.getNumOccurrences() && PSI && - PSI->isHotCountNthPercentile( -

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -71,7 +72,8 @@ static void emitRemark(IntrinsicInst *II, OptimizationRemarkEmitter &ORE, static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, const ProfileSummaryInfo *PSI, - OptimizationRemarkEmi

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -107,7 +108,18 @@ static bool removeUbsanTraps(Function &F, const BlockFrequencyInfo &BFI, case Intrinsic::allow_runtime_check: { ++NumChecksTotal; -bool ToRemove = ShouldRemove(BB); +bool ToRemove = ShouldRemoveRandom(); + +unsigned i

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -2,6 +2,14 @@ ; RUN: opt < %s -passes='function(lower-allow-check)' -S | FileCheck %s --check-prefixes=NOPROFILE ; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=0 -S | FileCheck %s --check-prefixes=NONE ; RUN: opt < %s -passes='function

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124211 >From 5d1944f522152a7356d8e8147d3b3c5939c32526 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/7] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to Lower

[clang] [llvm] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124211 >From 5d1944f522152a7356d8e8147d3b3c5939c32526 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/4] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to Lower

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124211 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124211 >From 5d1944f522152a7356d8e8147d3b3c5939c32526 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/6] [ubsan] Plumb through -fsanitize-skip-hot-cutoff to Lower

[clang] [llvm] [ubsan] Parse and use in LowerAllowCheckPass (PR #124211)

2025-01-27 Thread Thurston Dang via cfe-commits
@@ -2314,7 +2314,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, Opts.SanitizeSkipHotCutoffs = parseSanitizerWeightedKinds( "-fsanitize-skip-hot-cutoff=", Args.getAllArgValues(OPT_fsanitize_skip_hot_cutoff_EQ), Diags); - --

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-28 Thread Thurston Dang via cfe-commits
@@ -7,18 +10,26 @@ // CHECK-LABEL: define dso_local noundef i32 @div( // CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { // CHECK-NEXT: [[ENTRY:.*:]] -// CHECK-NEXT:[[TMP0:%.*]] = icmp eq i32 [[Y]], 0, !nosanitize [[META2:

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-28 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + bool lowerAllowCheck = LowerAllowCheckPass::IsRequested(); thurstond wro

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/124857 This adds the plumbing between -fsanitize-skip-hot-cutoff (introduced in https://github.com/llvm/llvm-project/pull/121619) and LowerAllowCheckPass (introduced in https://github.com/llvm/llvm-project/pull/124

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/4] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [llvm] [BoundsChecking] Update ubsantrap to use GuardKind (PR #124613)

2025-01-28 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/124613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/7] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 01/16] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllo

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/124857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/8] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/9] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,30 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + // SanitizeSkipHotCutoffs: doubles with range [0, 1] + // Opts.cutoffs: ints with range

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,30 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + // SanitizeSkipHotCutoffs: doubles with range [0, 1] + // Opts.cutoffs: ints with range

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -43,6 +44,23 @@ std::optional SanitizerMaskCutoffs::operator[](unsigned Kind) const { void SanitizerMaskCutoffs::clear(SanitizerMask K) { set(K, 0); } +std::optional> +SanitizerMaskCutoffs::getAllScaled(int ScalingFactor) const { + std::vector scaledCutoffs; + + bool an

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,30 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + // SanitizeSkipHotCutoffs: doubles with range [0, 1] + // Opts.cutoffs: ints with range

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -43,6 +44,23 @@ std::optional SanitizerMaskCutoffs::operator[](unsigned Kind) const { void SanitizerMaskCutoffs::clear(SanitizerMask K) { set(K, 0); } +std::optional> +SanitizerMaskCutoffs::getAllScaled(int ScalingFactor) const { + std::vector scaledCutoffs;

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -43,6 +44,23 @@ std::optional SanitizerMaskCutoffs::operator[](unsigned Kind) const { void SanitizerMaskCutoffs::clear(SanitizerMask K) { set(K, 0); } +std::optional> +SanitizerMaskCutoffs::getAllScaled(int ScalingFactor) const { + std::vector scaledCutoffs; + + bool an

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/124857 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,30 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + // SanitizeSkipHotCutoffs: doubles with range [0, 1] + // Opts.cutoffs: ints with range

[clang] Revert "[ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass" (PR #125032)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/125032 Reverts llvm/llvm-project#124857 due to buildbot breakage (https://lab.llvm.org/buildbot/#/builders/46/builds/11310) >From ce5e19e3a1ac6ecbf39a702a4cb55d12ac1b0849 Mon Sep 17 00:00:00 2001 From: Thurston Dang

[clang] Revert "[ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass" (PR #125032)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/125032 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Reapply "[ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass" (#125032) (PR #125037)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/125037 This reverts commit 928cad49beec0120686478f502899222e836b545 i.e., relands dccd27112722109d2e2f03e8da9ce8690f06e11b, with a fix to avoid use-after-scope by changing the lambda to capture by value.

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -3614,29 +3614,35 @@ void CodeGenFunction::EmitCheck( llvm::Value *RecoverableCond = nullptr; llvm::Value *TrapCond = nullptr; bool NoMerge = false; + // Expand checks into: + // (Check1 || !allow_ubsan_check) && (Check2 || !allow_ubsan_check) ... + // We need sep

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -3614,29 +3614,35 @@ void CodeGenFunction::EmitCheck( llvm::Value *RecoverableCond = nullptr; llvm::Value *TrapCond = nullptr; bool NoMerge = false; + // Expand checks into: + // (Check1 || !allow_ubsan_check) && (Check2 || !allow_ubsan_check) ... + // We need sep

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + bool lowerAllowCheck = LowerAllowCheckPass::IsRequested(); + // Is there a non-zero cuto

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/6] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/124857 >From 68246540d28c765af1fe4d61244e35cc8ff723cc Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Wed, 22 Jan 2025 18:59:07 + Subject: [PATCH 1/5] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowC

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + bool lowerAllowCheck = LowerAllowCheckPass::IsRequested(); + // Is there a non-zero cuto

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + bool lowerAllowCheck = LowerAllowCheckPass::IsRequested(); + // Is there a non-zero cuto

[clang] [ubsan] Connect -fsanitize-skip-hot-cutoff to LowerAllowCheckPass (PR #124857)

2025-01-29 Thread Thurston Dang via cfe-commits
@@ -795,12 +795,29 @@ static void addSanitizers(const Triple &TargetTriple, PB.registerOptimizerLastEPCallback(SanitizersCallback); } - if (LowerAllowCheckPass::IsRequested()) { + bool lowerAllowCheck = LowerAllowCheckPass::IsRequested(); + // Is there a non-zero cuto

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
@@ -20,13 +20,22 @@ namespace llvm { +struct LowerAllowCheckOptions { + std::vector placeholder; // TODO: cutoffs thurstond wrote: Done https://github.com/llvm/llvm-project/pull/122765 ___ cfe-commits mailing lis

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/122765 >From 6c244a083b458637f35149547270ba25675ca417 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Mon, 13 Jan 2025 18:38:14 + Subject: [PATCH 1/3] [sanitizer][NFCI] Add Options to LowerAllowCheckPass This

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
@@ -20,13 +20,22 @@ namespace llvm { +struct LowerAllowCheckOptions { thurstond wrote: Done https://github.com/llvm/llvm-project/pull/122765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.ll

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/122765 >From 261f722bcdefc143ceb25bd6d8e5499e189fc647 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Mon, 13 Jan 2025 18:38:14 + Subject: [PATCH 1/2] [sanitizer][NFCI] Add Options to LowerAllowCheckPass This

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/122765 This is glue code to convert LowerAllowCheckPass from a FUNCTION_PASS to FUNCTION_PASS_WITH_PARAMS. The parameters are currently unused. Future work will plumb `-fsanitize-skip-hot-cutoff` (introduced in htt

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond ready_for_review https://github.com/llvm/llvm-project/pull/122765 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass (PR #122765)

2025-01-13 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/122765 >From 6c244a083b458637f35149547270ba25675ca417 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Mon, 13 Jan 2025 18:38:14 + Subject: [PATCH 1/2] [sanitizer][NFCI] Add Options to LowerAllowCheckPass This

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-03 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/121619 This adds a function to parse weighted sanitizer flags (e.g., -fsanitize-blah=undefined=0.5,null=0.3) and adds the plumbing to apply that to -fno-sanitize-top-hot from the frontend to backend. -fno-sanitize-

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-03 Thread Thurston Dang via cfe-commits
https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/121619 >From ca1fabc5ea75af0acdd1969c0ad505e04103e1c9 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Sat, 4 Jan 2025 02:53:00 + Subject: [PATCH 1/2] [sanitizer] Parse weighted sanitizer args and -fno-sanitiz

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-03 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/121619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Reapply "[sanitizer][NFCI] Add Options parameter to LowerAllowCheckPass" (#122833) (PR #122994)

2025-01-14 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/122994 This reverts commit 1515caf7a59dc20cb932b724b2ef5c1d1a593427 (https://github.com/llvm/llvm-project/pull/122833) i.e., relands 7d8b4eb0ead277f41ff69525ed807f9f6e227f37 (https://github.com/llvm/llvm-project/pul

[clang] [ubsan] Use SanitizerOrdinal instead of SanitizerMask for EmitCheck (exactly one sanitizer is required) (PR #122511)

2025-01-10 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/122511 The `Checked` parameter of `CodeGenFunction::EmitCheck` is of type `ArrayRef>`, which is overly generalized: SanitizerMask can denote that zero or more sanitizers are enabled, but `EmitCheck` requires that e

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-10 Thread Thurston Dang via cfe-commits
https://github.com/thurstond closed https://github.com/llvm/llvm-project/pull/122392 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [ubsan] Assert that each check only has one SanitizerKind (PR #122392)

2025-01-10 Thread Thurston Dang via cfe-commits
@@ -3603,6 +3603,8 @@ void CodeGenFunction::EmitCheck( llvm::Value *TrapCond = nullptr; bool NoMerge = false; for (int i = 0, n = Checked.size(); i < n; ++i) { thurstond wrote: https://github.com/llvm/llvm-project/pull/122511 https://github.com/llvm/llv

[clang] [ubsan] Use SanitizerOrdinal instead of SanitizerMask for EmitCheck (exactly one sanitizer is required) (PR #122511)

2025-01-10 Thread Thurston Dang via cfe-commits
https://github.com/thurstond edited https://github.com/llvm/llvm-project/pull/122511 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [sanitizer] Parse weighted sanitizer args and -fno-sanitize-top-hot (PR #121619)

2025-01-09 Thread Thurston Dang via cfe-commits
@@ -2649,6 +2649,14 @@ def fsanitize_undefined_strip_path_components_EQ : Joined<["-"], "fsanitize-unde HelpText<"Strip (or keep only, if negative) a given number of path components " "when emitting check metadata.">, MarshallingInfoInt, "0", "int">; +def fno_

[clang] [NFC] [BoundsSan] use structured bindings (PR #123228)

2025-01-16 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/123228 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-02-24 Thread Thurston Dang via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q

[clang] [ubsan] Remove -fsanitizer=vptr from -fsanitizer=undefined (PR #121115)

2025-02-25 Thread Thurston Dang via cfe-commits
@@ -214,13 +214,14 @@ Available checks are: the wrong dynamic type, or that its lifetime has not begun or has ended. Incompatible with ``-fno-rtti``. Link must be performed by ``clang++``, not ``clang``, to make sure C++-specific parts of the runtime library and

[clang] [clang] Implement __attribute__((format_matches)) (PR #116708)

2025-02-25 Thread Thurston Dang via cfe-commits
=?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q?Félix?= Cloutier , =?utf-8?q

[clang] [sanitizer] Apply AlwaysIn/Out in parseSanitizeArgs (PR #129405)

2025-03-01 Thread Thurston Dang via cfe-commits
https://github.com/thurstond created https://github.com/llvm/llvm-project/pull/129405 For backwards compatibility, `parseSanitizeArgs`/`parseSanitizeTrapArgs` had an incomplete refactoring in https://github.com/llvm/llvm-project/pull/119819, in order to accommodate the special case of vptr in

[clang] [clang] [sanitizer] predict trap checks succeed (PR #134310)

2025-04-03 Thread Thurston Dang via cfe-commits
thurstond wrote: > Trap checks fail at most once (when the program crashes). It's technically possible to have a signal handler that consumes SIGILL and then jumps over the offending instruction. The UBSan docs allude to this: "-fsanitize-trap=...: execute a trap instruction (doesn’t require U

[clang] [clang] [sanitizer] predict trap checks succeed (PR #134310)

2025-04-04 Thread Thurston Dang via cfe-commits
https://github.com/thurstond approved this pull request. https://github.com/llvm/llvm-project/pull/134310 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Track final substitution for Subst* AST nodes (PR #132748)

2025-04-05 Thread Thurston Dang via cfe-commits
thurstond wrote: If it is not quick and easy to fix forward, please consider reverting in the meantime, so that the buildbots can be green and provide useful feedback to contributors. Thanks! https://github.com/llvm/llvm-project/pull/132748 ___ cfe-c

[clang] [clang] Track final substitution for Subst* AST nodes (PR #132748)

2025-04-05 Thread Thurston Dang via cfe-commits
thurstond wrote: > @fmayer this patch touches nowhere near where those backtraces indicate. > #130182 is a far more likely culprit. #130182 cannot be the cause of the ongoing MSan buildbot failures, because it was already reverted two days ago in #134239 https://github.com/llvm/llvm-project/

[clang] [clang] Track final substitution for Subst* AST nodes (PR #132748)

2025-04-05 Thread Thurston Dang via cfe-commits
thurstond wrote: > @thurstond Well can you provide a more recent buildbot failure link where > #130182 is not on the list of possible culpirits? Because the link @fmayer > provided for sure included it. @mizvekov I localized the MSan error to this patch by re-running the buildbot script with

[clang] [clang] Track final substitution for Subst* AST nodes (PR #132748)

2025-04-06 Thread Thurston Dang via cfe-commits
thurstond wrote: > This will be fixed here: #134560 Thank you! https://github.com/llvm/llvm-project/pull/132748 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    1   2   3