Hacker News new | ask | show | jobs
by fdej 3377 days ago
gcc already optimises away loops like for (i = 0; i < n; i++) s += i;

It wouldn't be too much of a stretch to detect and optimise away code that computes linearly recurrent sequences.

1 comments

gcc removes recursion in that case: https://godbolt.org/g/R6iBup