[llvm] [BoundsChecking] Add guard= pass parameter (PR #122575)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 22:23:53 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.
----------------
thurstond wrote:

Should the allow_ubsan_check intrinsic be changed to use unsigned?

The other main usage in CodeGenFunction::EmitCheck is also non-negative:
```
    llvm::Value *Allow =
        Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::allow_ubsan_check),
                           llvm::ConstantInt::get(CGM.Int8Ty, /* SanitizerHandler */ CheckHandler));
```
```
enum SanitizerHandler {
#define SANITIZER_CHECK(Enum, Name, Version) Enum,
  LIST_SANITIZER_CHECKS
#undef SANITIZER_CHECK
};
```



https://github.com/llvm/llvm-project/pull/122575


More information about the llvm-commits mailing list