]> git.sur5r.net Git - cc65/commitdiff
Fixed an optimizer problem: A branch into a list of at least two branches
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 12 Jan 2009 19:48:28 +0000 (19:48 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 12 Jan 2009 19:48:28 +0000 (19:48 +0000)
pointing to themselves caused the optimizer to loop forever.

git-svn-id: svn://svn.cc65.org/cc65/trunk@3907 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/coptind.c

index 332ec13709e417d22a8c27e5f2a493925aa50242..67fa1f7e57477376ef01460914c88e64a8aef435 100644 (file)
@@ -406,17 +406,12 @@ unsigned OptJumpCascades (CodeSeg* S)
                /* Remember, we had changes */
                ++Changes;
 
                /* Remember, we had changes */
                ++Changes;
 
-               /* Done */
-               continue;
-
-           }
-
            /* Check if both are conditional branches, and the condition of
             * the second is the inverse of that of the first. In this case,
             * the second branch will never be taken, and we may jump directly
             * to the instruction behind this one.
             */
            /* Check if both are conditional branches, and the condition of
             * the second is the inverse of that of the first. In this case,
             * the second branch will never be taken, and we may jump directly
             * to the instruction behind this one.
             */
-           if ((E->Info & OF_CBRA) != 0 && (N->Info & OF_CBRA) != 0) {
+           } else if ((E->Info & OF_CBRA) != 0 && (N->Info & OF_CBRA) != 0) {
 
                CodeEntry* X;   /* Instruction behind N */
                CodeLabel* LX;  /* Label attached to X */
 
                CodeEntry* X;   /* Instruction behind N */
                CodeLabel* LX;  /* Label attached to X */
@@ -447,10 +442,6 @@ unsigned OptJumpCascades (CodeSeg* S)
 
                /* Remember, we had changes */
                ++Changes;
 
                /* Remember, we had changes */
                ++Changes;
-
-               /* Done */
-               continue;
-
            }
        }
 
            }
        }