Issue |
159990
|
Summary |
ScalarEvolution eats more than 8MB stack space
|
Labels |
new issue
|
Assignees |
|
Reporter |
sjoerdmeijer
|
Compiling this input results in a segfault on my machine when compiled with `-O3`:
```
#include <algorithm>
int a;
extern char b[];
long *c;
void e(bool d, bool f[][0][0]) {
#pragma clang loop unroll(enable)
for (int g = 0; g < 10; g++)
#pragma clang loop unroll(enable)
for (int h = 0; h < 10; h++) {
b[h] = 1;
for (short i = 0; i < 8 + 2; i += 2)
for (short j(std::max((unsigned long long)1849463778,
(unsigned long long)d) >>
f[g][1][g]);
j < 7; j += 4)
a &= c[j];
}
}
```
On my machine, the stack space size is 8MB, and with `ulimit -s unlimited`, compilation is not aborted.
It all start here:
```
#11749 0x0000aaaab24e146c in llvm::InductionDescriptor::isInductionPHI (Phi=0xaaaabab30858, TheLoop=0xaaaabac8cf80, SE=0xaaaaba91e480, D=..., Expr=0x0, CastsToIgnore=0x0) at /llvm-project/llvm/lib/Analysis/IVDescriptors.cpp:1619
#11750 0x0000aaaab3c245fc in (anonymous namespace)::CanonicalizeFreezeInLoopsImpl::run (this=0xffffffff34c8) at /llvm-project/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp:160
#11751 0x0000aaaab3c252e4 in (anonymous namespace)::CanonicalizeFreezeInLoops::runOnLoop (this=0xaaaabb7342d0, L=0xaaaabac8cf80) at /llvm-project/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp:251
```
And then it endlessly disappears in various ScalarEvolution helper functions. The full back trace is very long, I have attached it for completeness here: [gdb.txt](https://github.com/user-attachments/files/22452759/gdb.txt)
It must be hitting a corner case of an inefficient algorithm or something like that, but I haven't looked further into yet.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs