[libcxx-commits] [libcxx] [libc++] Encode additional ODR-affecting properties in the ABI tag (PR #69669)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 23 16:04:11 PDT 2023


ldionne wrote:

> I mean something else. Choose something that instantiates a lot of templates in our test suite, and then compile that to an object. We're increasing the size of the mangled names here, and I want to know what effect that has.

Ok, that makes sense. So here we go. I took `libcxx/test/std/algorithms/alg.modifying.operations/alg.transform/ranges.transform.binary.range.pass.cpp` since that was the slowest Ranges test, and those usually instantiate a lot of stuff.

First, with `-O0`:

```
$ bloaty O0-before.o
    FILE SIZE        VM SIZE
 --------------  --------------
  44.7%  3.72Mi   0.0%       0    String Table
  30.8%  2.56Mi  83.5%  2.56Mi    ,__text
  15.0%  1.25Mi   0.0%       0    [Unmapped]
   5.4%   458Ki  14.6%   458Ki    ,__compact_unwind
   3.4%   288Ki   0.0%       0    Symbol Table
   0.5%  40.3Ki   1.3%  40.3Ki    ,__const
   0.1%  10.7Ki   0.3%  10.7Ki    ,__literal16
   0.1%  6.80Ki   0.2%  6.80Ki    ,__data
   0.0%  2.68Ki   0.1%  2.68Ki    ,__literal4
   0.0%     872   0.0%       0    [Mach-O Headers]
   0.0%     664   0.0%     664    ,__cstring
   0.0%      16   0.0%      16    ,__gcc_except_tab
   0.0%       4   0.0%       4    []
 100.0%  8.32Mi 100.0%  3.07Mi    TOTAL

$ bloaty O0-after.o
    FILE SIZE        VM SIZE
 --------------  --------------
  44.8%  3.73Mi   0.0%       0    String Table
  30.8%  2.56Mi  83.5%  2.56Mi    ,__text
  15.0%  1.25Mi   0.0%       0    [Unmapped]
   5.4%   458Ki  14.6%   458Ki    ,__compact_unwind
   3.4%   288Ki   0.0%       0    Symbol Table
   0.5%  40.3Ki   1.3%  40.3Ki    ,__const
   0.1%  10.7Ki   0.3%  10.7Ki    ,__literal16
   0.1%  6.80Ki   0.2%  6.80Ki    ,__data
   0.0%  2.68Ki   0.1%  2.68Ki    ,__literal4
   0.0%     872   0.0%       0    [Mach-O Headers]
   0.0%     664   0.0%     664    ,__cstring
   0.0%      16   0.0%      16    ,__gcc_except_tab
   0.0%       4   0.0%       4    []
 100.0%  8.33Mi 100.0%  3.07Mi    TOTAL
```

There is a 0.1% size increase for that test (which should be pretty intensive in terms of instantiating libc++ internal symbols with the ABI tag).

Now with `-O3`:

```
$ bloaty O3-before.o
    FILE SIZE        VM SIZE
 --------------  --------------
  35.6%   109Ki   0.0%       0    String Table
  21.9%  67.6Ki  67.1%  67.6Ki    ,__text
  20.1%  62.2Ki   0.0%       0    [Unmapped]
  10.6%  32.7Ki  32.4%  32.7Ki    ,__compact_unwind
   6.0%  18.7Ki   0.0%       0    Optimization Hints
   5.4%  16.7Ki   0.0%       0    Symbol Table
   0.2%     728   0.0%       0    [Mach-O Headers]
   0.1%     313   0.3%     313    ,__cstring
   0.0%      72   0.1%      72    ,__const
   0.0%      64   0.1%      64    ,__literal16
   0.0%      19   0.0%      19    []
   0.0%       8   0.0%       8    ,__literal8
 100.0%   309Ki 100.0%   100Ki    TOTAL

$ bloaty O3-after.o
    FILE SIZE        VM SIZE
 --------------  --------------
  35.6%   109Ki   0.0%       0    String Table
  21.9%  67.6Ki  67.1%  67.6Ki    ,__text
  20.1%  62.2Ki   0.0%       0    [Unmapped]
  10.6%  32.7Ki  32.4%  32.7Ki    ,__compact_unwind
   6.0%  18.7Ki   0.0%       0    Optimization Hints
   5.4%  16.7Ki   0.0%       0    Symbol Table
   0.2%     728   0.0%       0    [Mach-O Headers]
   0.1%     313   0.3%     313    ,__cstring
   0.0%      72   0.1%      72    ,__const
   0.0%      64   0.1%      64    ,__literal16
   0.0%      19   0.0%      19    []
   0.0%       8   0.0%       8    ,__literal8
 100.0%   309Ki 100.0%   100Ki    TOTAL
```

This seems to show no difference at all between before and after at `-O3`.


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


More information about the libcxx-commits mailing list