Problem with Innermost Loops Detection

Guilherme de Lima Ottoni ottoni@ic.unicamp.br
Sun Sep 2 19:30:00 GMT 2001


Hi,

I've noticed that the detection of innermost loops does not work properly on
GCC-3.0. As it is stated in the 'struct loop' (in basic_block.h), a NULL value
in the 'inner' field would indicate it is an innermost loop, but sometimes this
is not true. For some non-innermost loops, this field is NULL. For example, in
the following RTL fragment, the loop from insn 548 to insn 595 has inner ==
NULL, although there is another loop inside it.
This RTL fragment is for the fir2dim program, from the DSPstone benchmark.

I don't know whether this is a known bug or not, and I have not investigated why
this happens.

So, can anyone tell me if there already exists another, reliable way (maybe a
function) to detect innermost loops correctly?

Thanks,
--
Guilherme Ottoni
CS MSc Student
IC-Unicamp / Brazil
http://www.ic.unicamp.br/~ottoni
-----------------------------------------
The Xingo Project
Code Optimization for Embedded Systems
An Open Software Initiative of IC-UNICAMP
-----------------------------------------




(note/i 548 1382 552 NOTE_INSN_LOOP_BEG 0)

(code_label/i 552 548 717 131 "" "" [1 uses])

(note 717 552 555 [bb 35] NOTE_INSN_BASIC_BLOCK 0)

(insn/i 555 717 1379 (set (mem:QI (reg/f:QI 222) 0)
        (reg:QI 144)) -1 (nil)
    (nil))

(insn 1379 555 951 (parallel[ 
            (set (reg/f:QI 222)
                (plus:QI (reg/f:QI 222)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 951 1379 556 (parallel[ 
            (set (reg/f:QI 166)
                (plus:QI (reg/f:QI 166)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 556 951 557 (parallel[ 
            (set (reg/v:QI 132)
                (plus:QI (reg/v:QI 132)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 557 556 913 (set (reg/v:QI 135)
        (const_int 0 [0x0])) -1 (nil)
    (expr_list:REG_EQUAL (const_int 0 [0x0])
        (nil)))

(insn 913 557 929 (set (reg/v:QI 135)
        (const_int 3 [0x3])) -1 (nil)
    (nil))

(insn 929 913 937 (set (reg/f:QI 163)
        (reg/v:QI 132)) -1 (nil)
    (nil))

(insn 937 929 1360 (set (reg/f:QI 164)
        (reg/v:QI 131)) -1 (nil)
    (nil))

(insn 1360 937 1368 (set (reg/f:QI 219)
        (reg/v:QI 132)) -1 (nil)
    (nil))

(insn 1368 1360 558 (set (reg/f:QI 220)
        (reg/v:QI 131)) -1 (nil)
    (nil))

(note/i 558 1368 562 NOTE_INSN_LOOP_BEG 0)

(code_label/i 562 558 718 134 "" "" [1 uses])

(note 718 562 565 [bb 36] NOTE_INSN_BASIC_BLOCK 0)

(insn/i 565 718 1365 (set (reg:QI 147)
        (mem:QI (reg/f:QI 220) 0)) -1 (nil)
    (nil))

(insn 1365 565 934 (parallel[ 
            (set (reg/f:QI 220)
                (plus:QI (reg/f:QI 220)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 934 1365 566 (parallel[ 
            (set (reg/f:QI 164)
                (plus:QI (reg/f:QI 164)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 566 934 1357 (set (mem:QI (reg/f:QI 219) 0)
        (reg:QI 147)) -1 (nil)
    (nil))

(insn 1357 566 926 (parallel[ 
            (set (reg/f:QI 219)
                (plus:QI (reg/f:QI 219)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 926 1357 567 (parallel[ 
            (set (reg/f:QI 163)
                (plus:QI (reg/f:QI 163)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 567 926 1376 (parallel[ 
            (set (reg/v:QI 131)
                (plus:QI (reg/v:QI 131)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 1376 567 948 (parallel[ 
            (set (reg/f:QI 222)
                (plus:QI (reg/f:QI 222)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 948 1376 568 (parallel[ 
            (set (reg/f:QI 166)
                (plus:QI (reg/f:QI 166)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 568 948 569 (parallel[ 
            (set (reg/v:QI 132)
                (plus:QI (reg/v:QI 132)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(note/i 569 568 916 NOTE_INSN_LOOP_CONT 0)

(insn 916 569 846 (parallel[ 
            (set (reg/v:QI 135)
                (plus:QI (reg/v:QI 135)
                    (const_int -1 [0xffffffff])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(note 846 916 920 NOTE_INSN_LOOP_VTOP 0)

(insn 920 846 921 (parallel[ 
            (set (cc0)
                (reg/v:QI 135))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(jump_insn 921 920 579 (set (pc)
        (if_then_else (ge (cc0)
                (const_int 0 [0x0]))
            (label_ref 562)
            (pc))) -1 (nil)
    (expr_list:REG_NONNEG (reg/v:QI 135)
        (nil)))

(note/i 579 921 1352 NOTE_INSN_LOOP_END 0)

(insn 1352 579 919 (set (reg:QI 218)
        (const_int -1 [0xffffffff])) -1 (nil)
    (nil))

(insn 919 1352 720 (set (reg/v:QI 135)
        (const_int 4 [0x4])) -1 (nil)
    (nil))

(note 720 919 583 [bb 37] NOTE_INSN_BASIC_BLOCK 0)

(insn/i 583 720 1373 (set (mem:QI (reg/f:QI 222) 0)
        (reg:QI 144)) -1 (nil)
    (nil))

(insn 1373 583 945 (parallel[ 
            (set (reg/f:QI 222)
                (plus:QI (reg/f:QI 222)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn 945 1373 584 (parallel[ 
            (set (reg/f:QI 166)
                (plus:QI (reg/f:QI 166)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(insn/i 584 945 585 (parallel[ 
            (set (reg/v:QI 132)
                (plus:QI (reg/v:QI 132)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(note/i 585 584 587 NOTE_INSN_LOOP_CONT 0)

(insn/i 587 585 840 (parallel[ 
            (set (reg/v:QI 136)
                (plus:QI (reg/v:QI 136)
                    (const_int 1 [0x1])))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(note 840 587 589 NOTE_INSN_LOOP_VTOP 0)

(insn/i 589 840 590 (parallel[ 
            (set (cc0)
                (compare:QI (reg/v:QI 136)
                    (const_int 3 [0x3])))
            (clobber (scratch:QI))
            (clobber (scratch:QI))
        ] ) -1 (nil)
    (nil))

(jump_insn/i 590 589 595 (set (pc)
        (if_then_else (le (cc0)
                (const_int 0 [0x0]))
            (label_ref 552)
            (pc))) -1 (nil)
    (nil))

(note/i 595 590 723 NOTE_INSN_LOOP_END 0)



More information about the Gcc-help mailing list