Created attachment 10221 [details] test case When compiling this test case with -O2 -funroll-loops for i686 or sh-elf, the NOTE_INSN_LOOP_BEG and NOTE_INSN_LOOP_END notes end up adjacent before the loop, as can be seen in the .23.loop2_done dump file.
LOOP NOTES should be removed in 4.2 when loop.c is removed.
(In reply to comment #2) > LOOP NOTES should be removed in 4.2 when loop.c is removed. > There is more than loop.c which currently uses LOOP NOTES.
Actually there is nothing that uses LOOP_NOTEs other than the old RTL loop optimizer. At least, nothing that _should_ use it. Wanna know about loops? Find natural loops instead of depending on the notes. But the point is moot, the old RTL loop optimizer is no more.
(In reply to comment #4) > Actually there is nothing that uses LOOP_NOTEs other than the old RTL loop > optimizer. At least, nothing that _should_ use it. Wanna know about loops? > Find natural loops instead of depending on the notes. So you are saying I should put natural loop detection into the SH backend so that it can decide if it should save all target registers? Note that the branch probability estimation machinery does not set estimated execution counts, so the execution counts are unusable without profile data. > But the point is moot, the old RTL loop optimizer is no more. It had its weaknesses, but at least it was well-tuned for a wide range of target architectures and operated generally well together with the rest of the compiler. What we have now is a collection of passes that often work at cross-purposes. E.g. web, loop strength reduction/unrolling and auto-increment generation are completely out of sync.
(In reply to comment #5) > (In reply to comment #4) > > Actually there is nothing that uses LOOP_NOTEs other than the old RTL loop > > optimizer. At least, nothing that _should_ use it. Wanna know about loops? > > Find natural loops instead of depending on the notes. > > So you are saying I should put natural loop detection into the SH backend so > that it can decide if it should save all target registers? > Yes, if you need to detect loops, call the routine to detect natural loops. This is the way of the future. LOOP_NOTES are not. I agree that this bug should be marked WONTFIX. > It had its weaknesses, but at least it was well-tuned for a wide range of > target architectures and operated generally well together with the rest of the > compiler. What we have now is a collection of passes that often work at > cross-purposes. E.g. web, loop strength reduction/unrolling and > auto-increment generation are completely out of sync. Completely irrelevant to this bug. >
(In reply to comment #6) > Yes, if you need to detect loops, call the routine to detect natural loops. > This is the way of the future. > LOOP_NOTES are not. Is flow_loops_find and the data that it initailizes a stable interface, and can it be safely called from prologue/epilogue generation? I see no mention of this function in the files in doc/ ; the loop notes are documented there, though.
What are loop notes again? Ah, yes. Legacy. Fixed on mainline.