Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 820

Show
Ignore:
Timestamp:
12/27/10 06:48:36 (14 years ago)
Author:
walter
Message:

bugzilla 4379 ICE(blockopt.c): foreach over huge tuple, only with -O

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/backend/blockopt.c

    r728 r820  
    580580        block_appendexp(curblock, e); 
    581581        curblock->BC = BCretexp;        // put a return at the end 
    582582    } 
    583583    else 
    584584        curblock->BC = BCret;           // put a return at the end 
    585585    curblock = NULL;                    // undefined from now on 
    586586    block_last = NULL; 
    587587} 
    588588 
    589589 
    590590/****************************** 
    591591 * Perform branch optimization on basic blocks. 
    592592 */ 
    593593 
    594594void blockopt(int iter) 
    595595{   block *b; 
    596596    int count; 
    597597 
    598598    if (OPTIMIZER) 
    599599    { 
     600        int iterationLimit = 200; 
     601        if (iterationLimit < numblks) 
     602            iterationLimit = numblks; 
    600603        count = 0; 
    601604        do 
    602605        { 
    603606            //printf("changes = %d, count = %d, dfotop = %d\n",changes,count,dfotop); 
    604607#if MARS 
    605608            util_progress(); 
    606609#else 
    607610            if (controlc_saw) 
    608611                util_exit(EXIT_BREAK); 
    609612#endif 
    610613            changes = 0; 
    611614            bropt();                    // branch optimization 
    612615            brrear();                   // branch rearrangement 
    613616            blident();                  // combine identical blocks 
    614617            blreturn();                 // split out return blocks 
    615618            bltailmerge();              // do tail merging 
    616619            brtailrecursion();          // do tail recursion 
    617620            brcombine();                // convert graph to expressions 
    618621            if (iter >= 2) 
    619622                brmin();                // minimize branching 
    620623            do 
    621624            { 
    622625                compdfo();              /* compute depth first order (DFO) */ 
    623626                elimblks();             /* remove blocks not in DFO      */ 
    624                 assert(count < 200); 
     627                assert(count < iterationLimit); 
    625628                count++; 
    626629            } while (mergeblks());      /* merge together blocks         */ 
    627630        } while (changes); 
    628631#ifdef DEBUG 
    629632        if (debugw) 
    630633            for (b = startblock; b; b = b->Bnext) 
    631634                WRblock(b); 
    632635#endif 
    633636    } 
    634637    else 
    635638    { 
    636639        /* canonicalize the trees        */ 
    637640        for (b = startblock; b; b = b->Bnext) 
    638641        { 
    639642#ifdef DEBUG 
    640643            if (debugb) 
    641644                WRblock(b); 
    642645#endif 
    643646            if (b->Belem) 
    644647            {   b->Belem = doptelem(b->Belem,bc_goal[b->BC] | GOALstruct); 
  • trunk/src/backend/blockopt.c

    r728 r820  
    580580        block_appendexp(curblock, e); 
    581581        curblock->BC = BCretexp;        // put a return at the end 
    582582    } 
    583583    else 
    584584        curblock->BC = BCret;           // put a return at the end 
    585585    curblock = NULL;                    // undefined from now on 
    586586    block_last = NULL; 
    587587} 
    588588 
    589589 
    590590/****************************** 
    591591 * Perform branch optimization on basic blocks. 
    592592 */ 
    593593 
    594594void blockopt(int iter) 
    595595{   block *b; 
    596596    int count; 
    597597 
    598598    if (OPTIMIZER) 
    599599    { 
     600        int iterationLimit = 200; 
     601        if (iterationLimit < numblks) 
     602            iterationLimit = numblks; 
    600603        count = 0; 
    601604        do 
    602605        { 
    603606            //printf("changes = %d, count = %d, dfotop = %d\n",changes,count,dfotop); 
    604607#if MARS 
    605608            util_progress(); 
    606609#else 
    607610            if (controlc_saw) 
    608611                util_exit(EXIT_BREAK); 
    609612#endif 
    610613            changes = 0; 
    611614            bropt();                    // branch optimization 
    612615            brrear();                   // branch rearrangement 
    613616            blident();                  // combine identical blocks 
    614617            blreturn();                 // split out return blocks 
    615618            bltailmerge();              // do tail merging 
    616619            brtailrecursion();          // do tail recursion 
    617620            brcombine();                // convert graph to expressions 
    618621            if (iter >= 2) 
    619622                brmin();                // minimize branching 
    620623            do 
    621624            { 
    622625                compdfo();              /* compute depth first order (DFO) */ 
    623626                elimblks();             /* remove blocks not in DFO      */ 
    624                 assert(count < 200); 
     627                assert(count < iterationLimit); 
    625628                count++; 
    626629            } while (mergeblks());      /* merge together blocks         */ 
    627630        } while (changes); 
    628631#ifdef DEBUG 
    629632        if (debugw) 
    630633            for (b = startblock; b; b = b->Bnext) 
    631634                WRblock(b); 
    632635#endif 
    633636    } 
    634637    else 
    635638    { 
    636639        /* canonicalize the trees        */ 
    637640        for (b = startblock; b; b = b->Bnext) 
    638641        { 
    639642#ifdef DEBUG 
    640643            if (debugb) 
    641644                WRblock(b); 
    642645#endif 
    643646            if (b->Belem) 
    644647            {   b->Belem = doptelem(b->Belem,bc_goal[b->BC] | GOALstruct);