[PATCH] D133157: Add -sanitizer-coverage-control-flow

Navid Emamdoost via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 2 17:43:06 PDT 2022


Navidem added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:1055
+  for (auto &BB: F) {
+    // blockaddress may not be used on function's entry block.
+    if (&BB == &F.getEntryBlock())
----------------
Navidem wrote:
> kcc wrote:
> > vitalybuka wrote:
> > > what does happen?
> > "can not" ?
> Actually I started with "can not", but saw the error message from opt saying "may not". Changing anyways :)
Gives invalid IR error if `blockaddress` is used with function entry as arg.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:1057
+    if (&BB == &F.getEntryBlock())
+      CFs.push_back((Constant *)IRB.CreatePointerCast(&F, IntptrPtrTy));
+    else
----------------
vitalybuka wrote:
> static_cast or dyn_cast
Please check lines 739-746. This usage pattern is already there. Should we change those as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133157



More information about the cfe-commits mailing list