vitalybuka wrote:

> > @MaskRay can you talk more about your concerns? This won't affect compile 
> > time, and instrumenting a shadow load will cause an immediate crash of the 
> > application at runtime. This patch seems much more robust than counting on 
> > toolchains to always arrange to avoid double instrumentation.
> 
> From Eli: I'm a little skeptical that you pass pipeline is really doing what 
> you want if you end up running sanitizer passes twice; that indicates you're 
> running a bunch of other optimization passes twice without a good reason.
> 
> The other passes will affect compile time. There are many more 
> instrumentation passes than sanitizers. I am concerned this leads us to the 
> rabbit hole to add others (or others would blindly copy the pattern here, 
> when the use cases aren't recommended/endorsed for other platforms).

If we wanted to prevent for real we'd implement a diagnostics. The current 
state looks worth the the state with the patch.

Maybe this way?
```
copt<bool> IgnoreRerundantIntrumentation;

bool checkIfAlreadyIntrumenter(string_view flag) {
  if (M.getModuleFlag(flag)) {
    if (IgnoreRerundantIntrumentation)
        return PreservedAnalyses::all();
     diag();
  }
  M.addModuleFlag(Module::ModFlagBehavior::Override, flag, 1);
}

::run() {
  if (checkIfAlreadyIntrumenter("my_sanitizer"))
    return;
}
```

https://github.com/llvm/llvm-project/pull/99439
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to