http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49869
Summary: Excessive loop versioning done by vectorization + predictive commoning Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rgue...@gcc.gnu.org SUBROUTINE ANYAVG(NLVLS,HTS,PARRAY,ZBOT,NDXABV,ZTOP,NDXBLW,VALAVG) IMPLICIT NONE INTEGER I , NLVLS , NDXABV , NDXBLW REAL HTS(NLVLS) , PARRAY(NLVLS) , ZBOT , ZTOP , SUM , VALAVG REAL VALBOT , VALTOP IF ( ZBOT.LT.0.5 ) THEN ZBOT = 0.5 NDXABV = 2 ENDIF IF ( ZTOP.LT.0.51 ) THEN ZTOP = 0.51 NDXBLW = 2 ENDIF IF ( NDXBLW.LE.NDXABV ) GOTO 200 DO I = NDXABV + 1 , NDXBLW SUM = SUM + (HTS(I)-HTS(I-1))*0.5*(PARRAY(I)+PARRAY(I-1)) ENDDO 200 CONTINUE VALAVG = SUM/(ZTOP-ZBOT) END ends up with 5 loop copies.