[PATCH] D38063: [MSan] Disable sanitization for __sanitizer_dtor_callback.
Matt Morehouse via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 19 17:01:33 PDT 2017
morehouse created this revision.
Herald added a subscriber: hiraditya.
Eliminate unnecessary instrumentation at __sanitizer_dtor_callback
call sites. Fixes https://github.com/google/sanitizers/issues/861.
https://reviews.llvm.org/D38063
Files:
clang/lib/CodeGen/CGClass.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2588,6 +2588,7 @@
void visitCallSite(CallSite CS) {
Instruction &I = *CS.getInstruction();
+ if (I.getMetadata("nosanitize")) return;
assert((CS.isCall() || CS.isInvoke()) && "Unknown type of CallSite");
if (CS.isCall()) {
CallInst *Call = cast<CallInst>(&I);
Index: clang/lib/CodeGen/CGClass.cpp
===================================================================
--- clang/lib/CodeGen/CGClass.cpp
+++ clang/lib/CodeGen/CGClass.cpp
@@ -1588,7 +1588,9 @@
llvm::FunctionType::get(CGF.VoidTy, ArgTypes, false);
llvm::Value *Fn =
CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
- CGF.EmitNounwindRuntimeCall(Fn, Args);
+ llvm::CallInst *I = CGF.EmitNounwindRuntimeCall(Fn, Args);
+ I->setMetadata("nosanitize", llvm::MDNode::get(CGF.getLLVMContext(),
+ llvm::None));
}
class SanitizeDtorMembers final : public EHScopeStack::Cleanup {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38063.115929.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170920/4d9c547c/attachment.bin>
More information about the cfe-commits
mailing list