[PATCH] D85559: [MSAN] Reintroduce libatomic load/store instrumentation

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 7 15:30:20 PDT 2020


eugenis added a comment.

> __libatomic_load might come at the end of the function, with no succeeding BB

Not  exactly. It may come at the end of a BB.

We should probably fix it in clang by adding nounwind to libatomic calls, and ignore invokes here.



================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3509
+    FunctionType *ThunkTy = FunctionType::get(Void, {SizeType, SrcPtrType, DstPtrType, OrderingType}, false);
+    Function *Thunk = Function::Create(ThunkTy, GlobalValue::LinkOnceAnyLinkage, kMsanLibAtomicLoadThunkName, *M);
+    Thunk->addFnAttr("frame-pointer", "all");
----------------
Check if the function already exists.


================
Comment at: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp:3511
+    Thunk->addFnAttr("frame-pointer", "all");
+    BasicBlock *BB = BasicBlock::Create(M->getContext(), "", Thunk);
+
----------------
addVisibility(GlobalValue::HiddenVisibility);



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85559/new/

https://reviews.llvm.org/D85559



More information about the llvm-commits mailing list