https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128676
Bug ID: 128676
Summary: aarch64: compile time and memory double with each
statement of a chain of _BitInt(65)
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: compile-time-hog, memory-hog
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: shimizu2486 at gmail dot com
Target Milestone: ---
Target: aarch64-linux-gnu
Live reproducer: https://godbolt.org/z/v3qxe7Pcf
Compiling the following function for aarch64 at -O1 needs 2.5 GB of memory, and
every statement added to the chain roughly doubles memory and time.
$ cat t1.c
__int128 v;
#define S v = (__int128)(c & !(_BitInt(65))v) - 1;
void f(_Bool c) { S S S S S S S S S S S S S S S S }
$ /usr/bin/time -f "%M KB %e s" aarch64-linux-gnu-gcc -O1 -c t1.c
2476548 KB 3.35 s
With n copies of S, aarch64 trunk (842e09f03b64), -O1:
n max RSS time
8 49 MB 0.04 s
10 83 MB 0.08 s
12 218 MB 0.22 s
14 680 MB 0.95 s
16 2477 MB 3.35 s
aarch64 trunk (842e09f03b64) n=16: 2477 MB
aarch64 16.2.0 n=16: 2440 MB
aarch64 15.3.0 n=10: 1437 MB
aarch64 14.4.0 n=10: 1003 MB
-O1, -O2, -O3 and -Os are all affected. With -fno-tree-ter, n=16 needs 40 MB
and 0.03 s. x86-64 trunk needs 37 MB at n=14.