[llvm] [BoundsChecking] Add guard= pass parameter (PR #122575)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 10 22:45:29 PST 2025
================
@@ -29,6 +29,7 @@ class BoundsCheckingPass : public PassInfoMixin<BoundsCheckingPass> {
};
std::optional<Runtime> Rt; // Trap if empty.
bool Merge = false;
+ std::optional<int8_t> GuardKind; // `allow_ubsan_check` argument.
----------------
vitalybuka wrote:
In llvm everything is signed, instructions on values can be signed/unsigned.
We can add more bits, but can do that when needed.
I copied type from ubsantrap() parameter, but at that time I didn't notice that ubsantrap
accepts "CheckHandler" which are not SanitizerKind.
Also uint64_t is unnecessary for SanitizerOrdinal, can be 0-127:
```
/// Number of array elements.
static constexpr unsigned kNumElem = 2;
/// Mask value initialized to 0.
uint64_t maskLoToHigh[kNumElem]{};
```
we should add static_assert there to modify ubsantrap if we need more bits.
Better with clang patch for code you mentioned.
https://github.com/llvm/llvm-project/pull/122575
More information about the llvm-commits
mailing list