[compiler-rt] [asan] Speed up ASan ODR indicator-based checking (PR #100923)
Artem Pianykh via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 30 15:13:53 PDT 2024
================
@@ -147,14 +163,21 @@ static void CheckODRViolationViaIndicator(const Global *g) {
*odr_indicator = REGISTERED;
return;
}
+
+ // Fetch globals with the same ODR indicator.
+ auto *relevant_globals_lookup =
+ map_of_globals_by_indicator.find(g->odr_indicator);
+ if (!relevant_globals_lookup)
+ return;
+
+ ListOfGlobals *relevant_globals = relevant_globals_lookup->second;
// If *odr_indicator is DEFINED, some module have already registered
// externally visible symbol with the same name. This is an ODR violation.
- for (ListOfGlobals *l = list_of_all_globals; l; l = l->next) {
- if (g->odr_indicator == l->g->odr_indicator &&
----------------
artempyanykh wrote:
Good point! This is in line with the current behavior where it also stays in the list with an `UNREGISTERED` indicator. If we're ok keeping just the first global in the map, then removing from the map when unregistering is easy. If we need the whole list, removing is also not hard and should be still fast enough.
LMK if it's important to have removal from the map as part of this patch (or maybe as a patch on top).
https://github.com/llvm/llvm-project/pull/100923
More information about the llvm-commits
mailing list