[PATCH] D62888: [NewPM] Port Sancov

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 19:05:18 PDT 2019


leonardchan added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp:750
       Constant::getNullValue(ArrayTy), "__sancov_gen_");
+  appendToCompilerUsed(*CurModule, {Array});
 
----------------
chandlerc wrote:
> There is a `GlobalsToAppendToCompilerUsed` vector that we append `Array` to below (line 759). Why isn't that sufficient instead of this?
Ah, I didn't actually see this for some reason. The reason why it wasn't working before was bc I left the code that called 

```
  if (TargetTriple.isOSBinFormatMachO())
    appendToUsed(M, GlobalsToAppendToUsed);
  appendToCompilerUsed(M, GlobalsToAppendToCompilerUsed);
```

in `initializeModule`, so this never got appended. Fixed by moving this to a `finalizeModule` which runs after the function runs end.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62888





More information about the llvm-commits mailing list