hctim marked 3 inline comments as done. hctim added inline comments.
================ Comment at: clang/lib/CodeGen/SanitizerMetadata.cpp:67-72 + if (FsanitizeArgument.has(SanitizerKind::Address) && !Meta.NoAddress) { IsDynInit &= !CGM.isInNoSanitizeList(SanitizerKind::Address | SanitizerKind::KernelAddress, GV, Loc, Ty, "init"); Meta.IsDynInit = IsDynInit; } ---------------- hctim wrote: > vitalybuka wrote: > > I recommend to move this change into another patch > > > > and it should probably be: > > Meta.IsDynInit &= IsDynInit && > > FsanitizeArgument.has(SanitizerKind::Address) && !Meta.NoAddress && > > !CGM.isInNoSanitizeLis; > sure, will punt to follow-up patch (leaving comment open, will close it out > when i've added the dependency) (punted to D128672) ================ Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:1355-1356 // at all, we assume it has dynamic initializer (in other TU). - // - // FIXME: Metadata should be attched directly to the global directly instead - // of being added to llvm.asan.globals. - return G->hasInitializer() && !GlobalsMD.get(G).IsDynInit; + if (G->hasSanitizerMetadata() && G->getSanitizerMetadata().IsDynInit) + return false; + ---------------- vitalybuka wrote: > vitalybuka wrote: > > hctim wrote: > > > vitalybuka wrote: > > > > I believe previous was like this. > > > > if you want to change that lets do another patch. > > > refactored it slightly, it's clear to me now (and IMHO much clearer to > > > reason about, i suck at flipping multiple conditions in my head) that > > > it's the same code > > Before: G->hasInitializer() && !GlobalsMD.get(G).IsDynInit; > > Now: G->hasInitializer() && !(G->hasSanitizerMetadata() && > > G->getSanitizerMetadata().IsDynInit) > > > > Which is fine, because previously NoMD == !IsDynInit > > > > So logic-wise this version is LGTM > > equivalent one-liner is even cleaner: > > return G->hasInitializer() && !(G->hasSanitizerMetadata() && > > G->getSanitizerMetadata().IsDynInit) > > Before: G->hasInitializer() && !GlobalsMD.get(G).IsDynInit; > "Before" is "Before the patch" > I personally find the multi-liner much easier to read than the one-liner, okay to leave? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D127911/new/ https://reviews.llvm.org/D127911 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits