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

Dissappointing optimisation

Alex_Tingle
Beginner
426 Views

We are using 

IA-32, Version 11.0 Build 20081105.

Today I noticed an important optimisation you appear to have missed:

CHARACTER*256 ,ALLOCATABLE :: bigarray(:)
CHARACTER*256 last_entry
INTEGER*4    ix,found
...
  found = 1
  DO WHILE (.TRUE.) 
     ix = ix + 1
     IF (bigarray(ix) < last_entry) CYCLE
     IF (bigarray(ix) ==last_entry EXIT
     found = 0
     EXIT
  ENDDO
 
The issue is that the compiler does not treat this as a special case common subexpression and two calls to  
_for_cpstr are generated. 

 Regards

Peter Smith

0 Kudos
1 Reply
Steven_L_Intel1
Employee
426 Views

I'll pass that suggestion on to the developers - thanks.

0 Kudos
Reply