Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

Turning off loop blocking and unrolling

pravinkenator
Beginner
144 Views
Hello,

I'm currently using icc version 12.0.4 20110427. I read in the compiler optimization manual that. -O3 option, by default switches on the loop unrolling and loop blocking. I want to turn off these optimizations. How to do it ?
0 Kudos
2 Replies
Aubrey_W_
New Contributor I
144 Views
Hello,

I will move this to our Intel C++ Compiler forum where our engineers can have a look at your question.

Best regards,
==
Aubrey W.
Intel Software Network Support
TimP
Black Belt
144 Views
There's a documented compiler switch -unroll0 which should turn off unrolling (beyond what is inherent in vectorization). For an individual loop, $pragma unroll(0) or other pragmas may be useful.
In general, -O2 is already fairly aggressive in most situations, and we've had to drop back to it frequently in order to avoid additional optimizations presented by -O3.
If you mean loop distribution and fusion (altering the boundaries of for loops), besides considering -O2, you could consider placing
#pragma distribute point
immediately after the for(), so as to prevent the compiler from splitting the loop, or between loops, to prevent fusion.
Reply