15 Commits

Author SHA1 Message Date
Marco Elver
75432ce3c9
[LowerAllowCheck] Add llvm.allow.sanitize.* intrinsics (#172029)
Add new intrinsics:
  - llvm.allow.sanitize.address
  - llvm.allow.sanitize.thread
  - llvm.allow.sanitize.memory
  - llvm.allow.sanitize.hwaddress

These intrinsics return true if the corresponding sanitizer is enabled
for the function, and false otherwise. They are lowered by
LowerAllowCheckPass to constant booleans based on the corresponding
sanitize_* function attributes. LowerAllowCheckPass is now "required" to
run on functions with optnone to ensure correct lowering at O0.

The LowerAllowCheckPass already performs similar duties for
@llvm.allow.runtime.check and @llvm.allow.ubsan.check, although with
subtly different semantics (based on profiles and/or sampling). In this
case, we want to make the true/false decision based on if any one of
address/memory/thread sanitization is enabled.
2026-01-03 16:20:43 +01:00
Marco Elver
36089e5d98
[LowerAllowCheck] Rename removeUbsanTrap() to lowerAllowChecks() (#149847)
No traps are removed directly nor is this restricted to UBSan, therefore
rename the function doing the transformation of the intrinsic to match
its intent.

NFC.
2025-07-21 20:02:19 +02:00
Florian Mayer
48cd22c566
[NFC] simplify LowerAllowCheckPass::printPipeline (#149374) 2025-07-17 12:54:56 -07:00
Florian Mayer
71bc606e95
[LowerAllowCheckPass] allow to specify runtime.check hotness (#145998) 2025-06-27 11:28:07 -07:00
Florian Mayer
60a18d6119
[LowerAllowCheckPass] fix pipeline printing (#146000) 2025-06-26 21:35:35 -07:00
Florian Mayer
e0c7136713
[LowerAllowCheck] preserve CFG analyses (#145816) 2025-06-26 10:08:34 -07:00
Florian Mayer
e2cc82b177
[NFC] [LowerAllowCheck] use InstIterator (#145817) 2025-06-25 19:40:43 -07:00
Thurston Dang
fa9ac62d02
[ubsan] Parse and use <cutoffs[0,1,2]=70000;cutoffs[5,6,8]=90000> in LowerAllowCheckPass (#124211)
This adds and utilizes a cutoffs parameter for LowerAllowCheckPass, via the Options parameter (introduced in https://github.com/llvm/llvm-project/pull/122994).

Future work will connect -fsanitize-skip-hot-cutoff (introduced patch in https://github.com/llvm/llvm-project/pull/121619) in the clang frontend to the cutoffs parameter used here.
2025-01-27 20:08:53 -08:00
Ryan Mansfield
67efbd0bf1
[LLVM] Fix various cl::desc typos and whitespace issues (NFC) (#121955) 2025-01-08 11:07:23 +01:00
Kazu Hirata
4d12a14357
[Instrumentation] Remove unused includes (NFC) (#115117)
Identified with misc-include-cleaner.
2024-11-06 08:36:34 -08:00
Vitaly Buka
0954205235
[ubsan][hwasan] Let mixing filters (#100680)
Now the check will be enabled only if each filter is satisfied.
2024-07-26 11:54:09 -07:00
Nikita Popov
4169338e75
[IR] Don't include Module.h in Analysis.h (NFC) (#97023)
Replace it with a forward declaration instead. Analysis.h is pulled in
by all passes, but not all passes need to access the module.
2024-06-28 14:30:47 +02:00
Vitaly Buka
d927d1867f
[UBSAN] Emit optimization remarks (#88304) 2024-04-10 16:30:42 -07:00
Vitaly Buka
0646344062
[HWASAN][UBSAN] Reverse random logic (#88070)
It feels more intuitive to make higher P to keep more checks.
2024-04-08 17:23:47 -07:00
Vitaly Buka
49f0b536fd
[UBSAN] Rename remove-traps to lower-allow-check (#84853) 2024-04-04 21:29:46 -07:00