[PATCH] D150460: [gcov] Add nosanitize metadata to memory access instructions inserted by emitProfileNotes()

Mingjie Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 23:08:18 PDT 2023


Enna1 marked 2 inline comments as done.
Enna1 added a comment.

Thanks for you review!

> Why do we want to skip sanitizing these loads and stores?

When use asan and gcov together, asan will instrument the loads and stores inserted by gcov which increases the code size a lot.
As the loads and stores inserted by gcov are unlikey to have bugs, so I add nosanitize metadata to these  loads and stores like we do in SanitizerCoverage.

> Also, gocv is misspelled in the commit description, please fix that up.

Thanks for pointing this.



================
Comment at: llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp:150-152
+  void setNoSanitizeMetadata(Instruction *I) {
+    I->setMetadata(LLVMContext::MD_nosanitize, MDNode::get(*Ctx, std::nullopt));
+  }
----------------
nickdesaulniers wrote:
> This looks the same as `SanitizerMetadata::disableSanitizerForInstruction` and `ModuleSanitizerCoverage::SetNoSanitizeMetadata`. Rather than define a third copy, why not declare it as a new method on Instruction and define it in llvm/lib/IR/Metadata.cpp, then use it in all three places?
Send https://reviews.llvm.org/D150632 which adds Instruction::setNoSanitizeMetadata() and use it in SanitizerMetadata and SanitizerCoverage as suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150460



More information about the llvm-commits mailing list