[llvm] [TableGen, CodeGen, CHERI] Add support for the cPTR wildcard value type. (PR #158426)
Andrew Adams via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 14:00:37 PDT 2025
abadams wrote:
Oddly (if git bisect isn't lying to me), this commit makes `llvm::ARMAsmPrinter::emitAttributes` make a 1.5 MB stack allocation and overflow the stack on many platforms, causing widespread issues for Halide. Before this commit there was still a 0.5 MB stack allocation, which seems large, so I think this just tickles an existing problem in a way that makes it worse, rather than being the true cause. Here's the function preamble before this commit (at 0c1087b377b49dafaa7d82942db11c2fd3fd4c11)
```
0: f3 0f 1e fa endbr64
4: 55 push %rbp
5: 48 89 e5 mov %rsp,%rbp
8: 41 57 push %r15
a: 41 56 push %r14
c: 41 55 push %r13
e: 41 54 push %r12
10: 53 push %rbx
11: 4c 8d 9c 24 00 a0 f8 lea -0x76000(%rsp),%r11
18: ff
19: 48 81 ec 00 10 00 00 sub $0x1000,%rsp
20: 48 83 0c 24 00 orq $0x0,(%rsp)
25: 4c 39 dc cmp %r11,%rsp
28: 75 ef jne 19 <_ZN4llvm13ARMAsmPrinter14emitAttributesEv+0x19>
```
It's subtracting 0x76000 from the stack pointer in a loop, touching each page once
and here it is after:
```
0: f3 0f 1e fa endbr64
4: 55 push %rbp
5: 48 89 e5 mov %rsp,%rbp
8: 41 57 push %r15
a: 41 56 push %r14
c: 41 55 push %r13
e: 41 54 push %r12
10: 53 push %rbx
11: 4c 8d 9c 24 00 30 e8 lea -0x17d000(%rsp),%r11
18: ff
19: 48 81 ec 00 10 00 00 sub $0x1000,%rsp
20: 48 83 0c 24 00 orq $0x0,(%rsp)
25: 4c 39 dc cmp %r11,%rsp
28: 75 ef jne 19 <_ZN4llvm13ARMAsmPrinter14emitAttributesEv+0x19>
```
It's the same, but now it subtracts 0x17d000 from the stack pointer
https://github.com/llvm/llvm-project/pull/158426
More information about the llvm-commits
mailing list