[llvm-branch-commits] [clang][ubsan] Switch UBSAN optimization to `llvm.experimental.hot` (PR #84858)

Jon Roelofs via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 11 17:22:34 PDT 2024


================
@@ -3805,6 +3812,12 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
                                     SanitizerHandler CheckHandlerID) {
   llvm::BasicBlock *Cont = createBasicBlock("cont");
 
+  if (ClSanitizeExpHot) {
+    Checked =
+        Builder.CreateOr(Checked, Builder.CreateCall(CGM.getIntrinsic(
+                                      llvm::Intrinsic::experimental_hot)));
----------------
jroelofs wrote:

It might be helpful if there were a remark that fired when one of these were optimized out.

Maybe we could get that with another intrinsic whose semantics are "print the message in a remark if this gets optimized out", and then stick one of those on the appropriate side of the condition, with an explanation on where it came from, and what the threshold was.

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


More information about the llvm-branch-commits mailing list