[llvm-branch-commits] [clang] [compiler-rt] [llvm] [UBSan] Use -fsanitize-handler-preserve-all-regs in codegen (PR #168645)

Vitaly Buka via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 25 13:20:36 PST 2025


================
@@ -3789,15 +3789,26 @@ static void emitCheckHandlerCall(CodeGenFunction &CGF,
   bool NeedsAbortSuffix =
       IsFatal && RecoverKind != CheckRecoverableKind::Unrecoverable;
   bool MinimalRuntime = CGF.CGM.getCodeGenOpts().SanitizeMinimalRuntime;
+  // The preserve-all logic is somewhat duplicated in BoundsChecking.cpp for
+  // local-bounds. Make sure to change that too.
+  const auto &T = CGF.CGM.getTriple();
+  bool HandlerPreserveAllRegs =
+      CGF.CGM.getCodeGenOpts().SanitizeHandlerPreserveAllRegs &&
----------------
vitalybuka wrote:

There should be arch specific logic in codegen 

Eg. there are some UBSAN/sanitizer file which flip on/of features deppending on context
your patch is exporting the logic outside that thing 

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


More information about the llvm-branch-commits mailing list