Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

question

oren_peles
Beginner
342 Views
Hi

In a fortran code I wrote (schematically, I cant copy the origin code to here) there is the following if condition inside a loop. The variable in the if condition (ic) defined in a common block and its value set in other subroutine:

Do i=1, n
.
xx = 1
if (ic .eq.1) then
xx = .
endif
.
enddo

When I used ifort version 9.0.032 with O3 optimization, it dosnt enter to the if block so xx remains equal to one. I looked at the opt-report output and according to this report:
Condition at line 591 hoisted from loop at line 589 referring to those lines.

When I used ifort version 9.1.033 it was enter to the if block. This is the correct action. It wasnt hoisted the condition according to the opt-report.

What is the explanation to this phenomena? Is there a problem with version 9.0.32 which was fixed in version 9.1.033? what should I do to avoid such problems in the future? currently I dont have access to newer versions.

Thanks,
Oren

0 Kudos
1 Reply
TimP
Honored Contributor III
342 Views
A compiler might reasonably replace such a simple IF by a conditional move. If it could assure that the condition is loop invariant, it could be expected to hoist the condition outside the loop. Without some specifics, we can't see the nature of your problem.
0 Kudos
Reply