Forum Discussion
Altera_Forum
Honored Contributor
14 years agoCompilers typically do not attempt to try to guess what your intentions are by throwing optimizations at your code willy-nilly and potentially breaking it. For example the optimization you created by hand the compiler would not know to do since the statements in that loop should not be run if idx started off being 0 (which is commonly the initialization state of an uninitialized variable). So to enforce loop unrolling you should implement it manually; however, in the case of the loop you are talking about in the present state where idx starts unknown that doesn't look like a good idea to me.