4 ms·
After a quick investigation, clang (3.9, x86-64) doesn't seem to suffer from the same problem: https://godbolt.org/g/Uvo7iO https://godbolt.org/g/Uvo7iO
by krona 10y ago
After a quick investigation, clang (3.9, x86-64) doesn't seem to suffer from the same problem:
https://godbolt.org/g/Uvo7iO https://godbolt.org/g/Uvo7iO
- andreyv 10y agoWell, try to significantly increase the argument count in your example.
- tcbawo 10y agoCalling with 46 arguments seems to move this onto the stack: https://godbolt.org/g/tbKtGz https://godbolt.org/g/tbKtGz
- rurban 10y agoNo. It hits the constant folding threshold and calls the sum function with the args.
- DannyBee 10y agoUnlike GCC, clang will iterate gvn (what GCC calls fre, because in GCC, gvn is properly split into an analysis, and fre uses it to do full redundancy elimination) until it stops changing, and does so fairly early in the pipeline I wrote fre for GCC (and working on llvm's next gvn) and long story short, GCC is more powerful, but it doesn't always run early enough, and is not iterated. The general problem of detecting all herbrand equivalences is exponential time, even without trying to evaluate the code. So you can't win all the time anyway.