* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
@ 2015-06-22 7:55 ` miyuki at gcc dot gnu.org
2015-06-27 2:08 ` gang.chen.5i5j at gmail dot com
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: miyuki at gcc dot gnu.org @ 2015-06-22 7:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
Mikhail Maltsev <miyuki at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
Target| |blackfin
Last reconfirmed| |2015-6-22
CC| |miyuki at gcc dot gnu.org
--- Comment #1 from Mikhail Maltsev <miyuki at gcc dot gnu.org> ---
Started with r208165.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
2015-06-22 7:55 ` [Bug target/66620] " miyuki at gcc dot gnu.org
@ 2015-06-27 2:08 ` gang.chen.5i5j at gmail dot com
2015-06-27 2:17 ` gang.chen.5i5j at gmail dot com
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-27 2:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #2 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
(In reply to Mikhail Maltsev from comment #1)
> Started with r208165.
OK, thanks. Really it is, it is valuable to me (it can generate the correct
insns for comparing). And also if remove "-fno-reorder-blocks", it can generate
correct insns too (after comparing with the original correct insns, this
optimized insns are correct).
In our case, the issue insn is:
(insn 132 59 74 6 (parallel [
(set (reg:SI 45 LT1)
(label_ref 74))
(set (reg:SI 49 LB1)
(label_ref 133))
(set (reg:SI 47 LC1)
(reg:SI 8 P0 [112]))
]) lpt_commit.i:11 -1
(nil))
it is in an incorrect area, which want to optimize the insns below in another
area:
(note 68 67 69 9 [bb 9] NOTE_INSN_BASIC_BLOCK)
(insn:TI 69 68 109 9 (set (reg/v:SI 0 R0 [orig:94 iip ] [94])
(plus:SI (reg/v:SI 0 R0 [orig:94 iip ] [94])
(const_int 1 [0x1]))) lpt_commit.i:19 50 {addsi3}
(nil))
(jump_insn:TI 109 69 73 9 (parallel [
(set (pc)
(if_then_else (ne (reg:SI 8 P0 [112])
(const_int 1 [0x1]))
(label_ref:SI 70)
(pc)))
(set (reg:SI 8 P0 [112])
(plus:SI (reg:SI 8 P0 [112])
(const_int -1 [0xffffffffffffffff])))
(unspec [
(const_int 0 [0])
] 10)
(clobber (scratch:SI))
]) lpt_commit.i:19 96 {loop_end}
(int_list:REG_BR_PROB 7384 (nil))
-> 70)
The incorrect insn wants to merge the too "for (iip = 0; iip < 4; iip++) {...}"
in one.
Next, I shall continue analyzing it, and the all related insns are in
attachments. And welcome any ideas, suggestions and completions, Thanks.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
2015-06-22 7:55 ` [Bug target/66620] " miyuki at gcc dot gnu.org
2015-06-27 2:08 ` gang.chen.5i5j at gmail dot com
@ 2015-06-27 2:17 ` gang.chen.5i5j at gmail dot com
2015-06-27 2:18 ` gang.chen.5i5j at gmail dot com
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-27 2:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #3 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35862
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35862&action=edit
The insns for our issue.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (2 preceding siblings ...)
2015-06-27 2:17 ` gang.chen.5i5j at gmail dot com
@ 2015-06-27 2:18 ` gang.chen.5i5j at gmail dot com
2015-06-27 2:20 ` gang.chen.5i5j at gmail dot com
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-27 2:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #4 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35863
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35863&action=edit
The correct insns without -fno-reorder-blocks
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (3 preceding siblings ...)
2015-06-27 2:18 ` gang.chen.5i5j at gmail dot com
@ 2015-06-27 2:20 ` gang.chen.5i5j at gmail dot com
2015-06-27 7:32 ` gang.chen.5i5j at gmail dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-27 2:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #5 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35864
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35864&action=edit
The correct insns should be with -fno-reorder-blocks
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (4 preceding siblings ...)
2015-06-27 2:20 ` gang.chen.5i5j at gmail dot com
@ 2015-06-27 7:32 ` gang.chen.5i5j at gmail dot com
2015-06-28 9:45 ` gang.chen.5i5j at gmail dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-27 7:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #6 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
1st call in hwloop_optimize() in gcc/config/bfin/bfin.c, the input insns are
correct (just the same as insns-should_be.log), but the output insns are
incorrect (just the same as insns-issue.log).
Then 2nd call in hwloop_optimize() in gcc/config/bfin/bfin.c finds this issue,
then cause assert().
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (5 preceding siblings ...)
2015-06-27 7:32 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 9:45 ` gang.chen.5i5j at gmail dot com
2015-06-28 9:48 ` gang.chen.5i5j at gmail dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 9:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #7 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
(In reply to Chen Gang from comment #2)
> (In reply to Mikhail Maltsev from comment #1)
> > Started with r208165.
>
> OK, thanks. Really it is, it is valuable to me (it can generate the correct
> insns for comparing). And also if remove "-fno-reorder-blocks", it can
> generate correct insns too (after comparing with the original correct insns,
> this optimized insns are correct).
>
Oh, sorry, after check again, I missed the left output (which is final output)
when remove "-fno-reorder-blocks".
For removing "-fno-reorder-blocks", it is passed compiling, but we should check
the assembly output too: hwloop_optimize() generates almost the same insns just
like having "-fno-reorder-blocks", but it is passed compiling.
The related full insns for removing "-fno-reorder-blocks" are in the next
attachment.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (6 preceding siblings ...)
2015-06-28 9:45 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 9:48 ` gang.chen.5i5j at gmail dot com
2015-06-28 13:54 ` gang.chen.5i5j at gmail dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #8 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35866
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35866&action=edit
Full insns for without "-fno-reorder-blocks".
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (7 preceding siblings ...)
2015-06-28 9:48 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 13:54 ` gang.chen.5i5j at gmail dot com
2015-06-28 13:57 ` gang.chen.5i5j at gmail dot com
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #9 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
After check the assembly result for the without "-fno-reorder-block", it is OK.
It is for lsetup optimization.
And for having "-fno-reorder-block", the insns are also correct, and after skip
the related assert(), it can also pass compiling and generate the correct
assembly code.
The related diff is below, and the related assembly code is in the next
attachment.
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 3b4b54e..91866dd 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3520,7 +3520,13 @@ hwloop_optimize (hwloop_info loop)
if (vec_safe_length (loop->incoming) > 1
|| !(loop->incoming->last ()->flags & EDGE_FALLTHRU))
{
- gcc_assert (JUMP_P (insn));
+ if (!JUMP_P (insn))
+ {
+ if (dump_file)
+ fprintf (dump_file, ";; loop %d lsetup may already inserted\n",
+ loop->loop_no);
+ return false;
+ }
insn = PREV_INSN (insn);
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (8 preceding siblings ...)
2015-06-28 13:54 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 13:57 ` gang.chen.5i5j at gmail dot com
2015-06-28 13:58 ` gang.chen.5i5j at gmail dot com
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #10 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35867
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35867&action=edit
The result after skip the assert() for having "-fno-reorder-block"
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (9 preceding siblings ...)
2015-06-28 13:57 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 13:58 ` gang.chen.5i5j at gmail dot com
2015-06-28 14:02 ` gang.chen.5i5j at gmail dot com
2015-09-03 2:45 ` gang.chen.5i5j at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 13:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #11 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35868
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35868&action=edit
The result when without "-fno-reorder-block"
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (10 preceding siblings ...)
2015-06-28 13:58 ` gang.chen.5i5j at gmail dot com
@ 2015-06-28 14:02 ` gang.chen.5i5j at gmail dot com
2015-09-03 2:45 ` gang.chen.5i5j at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-28 14:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
--- Comment #12 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Created attachment 35869
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35869&action=edit
The result before lsetup optimization
The lsetup information is below:
lsetup (loop_begin, loop_end) count.
R0 will add 1 for each times, in our case, it is initialized to 0 before
lsetup().
After the loop_end, in our case, it needs "R0 += 1" to increase the last count.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug target/66620] bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails.
2015-06-22 1:54 [Bug target/66620] New: bfin: bfin.c: (hwloop_optimize): gcc_assert (JUMP_P (insn)) fails gang.chen.5i5j at gmail dot com
` (11 preceding siblings ...)
2015-06-28 14:02 ` gang.chen.5i5j at gmail dot com
@ 2015-09-03 2:45 ` gang.chen.5i5j at gmail dot com
12 siblings, 0 replies; 14+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-09-03 2:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66620
Chen Gang <gang.chen.5i5j at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #14 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
It is already fixed. Just change the status.
^ permalink raw reply [flat|nested] 14+ messages in thread