[libcxx-commits] [libcxx] [libc++][NFC] Remove a bunch of redundant ASan existence checks (PR #128504)

Vitaly Buka via libcxx-commits libcxx-commits at lists.llvm.org
Fri May 30 16:33:38 PDT 2025


vitalybuka wrote:

> Yeah.. that's tricky. I'd argue that a (most likely generated?) function with 4000 assignment statements like this is a degenerate case. I mean something similar could happen with any other legitimate code transformation inside libc++.

I can see benefits of cleaner code, but given that it's a very common library, I also can see benefits of having sometimes less readable code, if it helps compiler.

Either way is fine to me.

> 
> I'd suggest rewriting the function as
> 
> ```
> std::pair<char const*, char const*> data = {{"some text", "other text"}, ...};
> m.insert(begin(data), end(data));

Already done.

more like:
```
m = flat_map<std::string, std::string>({
      {"a", "b"},
       ...
  });
```

There also is a inefficiency in SROA, I am working on patches.

> ```
> 
> or something similar.



https://github.com/llvm/llvm-project/pull/128504


More information about the libcxx-commits mailing list