[PATCH] D52739: [PassManager/Sanitizer] Port of AddresSanitizer pass from legacy to new PassManager

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 20:10:04 PDT 2018


leonardchan added a comment.

> I meant just merging the //passes//. In the sense that you have one pass class with one module run() method and one function run() method. The question then is whether you'll ever want to use different options for the different IRUnits.

I see. As far as I can tell, both passes actually use the same options for `CompileKernel` and `Recover` when creating new passes, but `UseAfterScope` is different for both in that the option is passed from a code gen option for AddressSanitizer whereas AddressSanitizerModule sets `UseAfterScope` as true by default and is dependent on if ASan uses garbage collection friendly instrumentation for globals. I think this is a reason to keep them separate.



================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:2538
+                                  const TargetLibraryInfo *TLI) {
+  if (!Inited) {
+    // Initialize the private fields. No one has accessed them before.
----------------
philip.pfaffe wrote:
> leonardchan wrote:
> > philip.pfaffe wrote:
> > > Instead of doing this kind of lazy initialization, just do it in the constructor.
> > This initialization requires access to the Module that this pass runs over but I don't think I have access to that in the constructor.
> Yes you do. You're now constructing one instance of this per pass run, you can just pass along the module there.
My bad. Didn't notice that.


Repository:
  rL LLVM

https://reviews.llvm.org/D52739





More information about the llvm-commits mailing list