[clang] [llvm] [ubsan] Change ubsan-unique-traps to use nomerge instead of counter (PR #117651)
Thurston Dang via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 26 13:25:49 PST 2024
================
@@ -3919,18 +3919,16 @@ void CodeGenFunction::EmitTrapCheck(llvm::Value *Checked,
Builder.CreateCondBr(Checked, Cont, TrapBB);
EmitBlock(TrapBB);
- llvm::CallInst *TrapCall = Builder.CreateCall(
- CGM.getIntrinsic(llvm::Intrinsic::ubsantrap),
- llvm::ConstantInt::get(CGM.Int8Ty,
- ClSanitizeDebugDeoptimization
- ? TrapBB->getParent()->size()
- : static_cast<uint64_t>(CheckHandlerID)));
+ llvm::CallInst *TrapCall =
+ Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::ubsantrap),
+ llvm::ConstantInt::get(CGM.Int8Ty, CheckHandlerID));
if (!CGM.getCodeGenOpts().TrapFuncName.empty()) {
auto A = llvm::Attribute::get(getLLVMContext(), "trap-func-name",
CGM.getCodeGenOpts().TrapFuncName);
TrapCall->addFnAttr(A);
}
+ TrapCall->addFnAttr(llvm::Attribute::NoMerge);
----------------
thurstond wrote:
https://github.com/llvm/llvm-project/commit/5107ce194c9b03c2f32eb1508df0c92b13b3e2fd doesn't work because of inlining: none of the ubsantraps in function m() have nomerge, because they were each unique ubsantraps in the non-inlined functions.
Is there a downside to emitting nomerge for every ubsantrap (even the first instance)?
https://github.com/llvm/llvm-project/pull/117651
More information about the cfe-commits
mailing list