Remove Branch To END IF 

Description:  The Remove ­Branch ­To ­End ­If refactoring option removes the branch to END IF statements. The GOTO statements carry outbranching. Branching to END IF  is replaced with branching to CONTINUE statement that immediately follows the END IF statement.
 
State: Implemeted         Author:  Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka     Version:  Photran 7

Code Example:

   PROGRAM RemoveBranchEX1_1
      INTEGER :: sum, i
      sum = 0
      DO 20, i = 1, 10
        IF (MOD(i,2).eq.0) THEN
           GOTO 10
        END IF
     sum = sum + i
     IF (sum.ge.100) THEN
       sum = sum + sum
10 END IF
20 CONTINUE
     PRINT *, 'sum:', sum
END PROGRAM RemoveBranchEX1_1

    PROGRAM RemoveBranchEX1_1
     INTEGER :: sum, i
     sum = 0
     DO 20, i = 1, 10
         IF (MOD(i,2).eq.0) THEN
             GOTO 20
         END IF
     sum = sum + i
     IF (sum.ge.100) THEN
           sum = sum + sum
     END IF
20 CONTINUE
     PRINT *, 'sum:', sum
END PROGRAM RemoveBranchEX1_1

ScreenShots

      

HTML Comment Box is loading comments...