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

Florian Mayer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 25 12:46:30 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 &&
----------------
fmayer wrote:

but what do we gain from that? it makes the logic harder to follow, because now it is split between codegen and driver. also now the driver and frontend flag have different meanings

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


More information about the llvm-branch-commits mailing list