[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 Oleg Endo olegendo at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED --- Comment #8 from Oleg Endo olegendo at gcc dot gnu.org 2012-11-05 01:36:41 UTC --- I think this can be closed as it has been fixed.
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 --- Comment #7 from Oleg Endo olegendo at gcc dot gnu.org 2012-11-01 21:19:53 UTC --- I guess this is done, isn't it Easwaran?
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 --- Comment #6 from eraman at gcc dot gnu.org 2012-10-31 23:28:52 UTC --- Author: eraman Date: Wed Oct 31 23:28:45 2012 New Revision: 193052 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=193052 Log: 2012-10-31 Easwaran Raman era...@google.com PR target/54938 PR middle-end/54957 * optabs.c (emit_cmp_and_jump_insn_1): Add REG_BR_PROB note only if it doesn't already exist. * stmt.c (get_outgoing_edge_probs): Return 0 if BB is NULL. (emit_case_dispatch_table): Handle the case where STMT_BB is NULL. (expand_sjlj_dispatch_table): Pass BB containing before_case to emit_case_dispatch_table. Modified: trunk/gcc/ChangeLog trunk/gcc/optabs.c trunk/gcc/stmt.c
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 Oleg Endo olegendo at gcc dot gnu.org changed: What|Removed |Added CC||olegendo at gcc dot gnu.org --- Comment #1 from Oleg Endo olegendo at gcc dot gnu.org 2012-10-16 11:43:37 UTC --- Could you please try to extract a preprocessed source for this one? I'm afraid some of my recent patches for PR 51244 might have introduced this :T
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 --- Comment #2 from Jorn Wolfgang Rennecke amylaar at gcc dot gnu.org 2012-10-16 12:35:47 UTC --- Created attachment 28454 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=28454 preprocessed source cc1 invocation from using -v --save-temps: /home/amylaar/fsf/sh-192491/./gcc/cc1 -fpreprocessed fp-bit.i -quiet -dumpbase fp-bit.c -auxbase-strip _unpack_df.o -g -g -g -O2 -O2 -O2 -Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -version -fbuilding-libgcc -fno-stack-protector -fvisibility=hidden -o fp-bit.s
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 Oleg Endo olegendo at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2012-10-16 CC||eraman at google dot com Ever Confirmed|0 |1 --- Comment #3 from Oleg Endo olegendo at gcc dot gnu.org 2012-10-16 13:28:10 UTC --- Thanks Jörn. The problem is not related to my changes in PR 51244. It is caused by the latest change to optabs.c: 2012-10-15 Easwaran Raman era...@google.com * optabs.c (emit_cmp_and_jump_insn_1): Add a new parameter to specificy the probability of taking the jump. (emit_cmp_and_jump_insns): Likewise. In emit_cmp_and_jump_insn_1, the line gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); blows up, because of config/sh/sh.c (expand_cbranchsi4): rtx jump = emit_jump_insn (branch_expander (operands[3])); if (probability = 0) add_reg_note (jump, REG_BR_PROB, GEN_INT (probability)); The following seems to fix the problem Index: gcc/optabs.c === --- gcc/optabs.c(revision 192494) +++ gcc/optabs.c(working copy) @@ -4270,8 +4270,8 @@ JUMP_P (insn) any_condjump_p (insn)) { - gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); - add_reg_note (insn, REG_BR_PROB, GEN_INT (prob)); + if (!find_reg_note (insn, REG_BR_PROB, 0)) +add_reg_note (insn, REG_BR_PROB, GEN_INT (prob)); } } Easwaran, could you please have a look at that? Does the change above make sense?
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 --- Comment #4 from Easwaran Raman eraman at google dot com 2012-10-16 17:04:05 UTC --- (In reply to comment #3) Thanks Jörn. The problem is not related to my changes in PR 51244. It is caused by the latest change to optabs.c: 2012-10-15 Easwaran Raman era...@google.com * optabs.c (emit_cmp_and_jump_insn_1): Add a new parameter to specificy the probability of taking the jump. (emit_cmp_and_jump_insns): Likewise. In emit_cmp_and_jump_insn_1, the line gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); blows up, because of config/sh/sh.c (expand_cbranchsi4): rtx jump = emit_jump_insn (branch_expander (operands[3])); if (probability = 0) add_reg_note (jump, REG_BR_PROB, GEN_INT (probability)); I am confused why this code causes the assert in emit_cmp_and_jump_insn_1. Could you please attach a stack trace? The following seems to fix the problem Index: gcc/optabs.c === --- gcc/optabs.c(revision 192494) +++ gcc/optabs.c(working copy) @@ -4270,8 +4270,8 @@ JUMP_P (insn) any_condjump_p (insn)) { - gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); - add_reg_note (insn, REG_BR_PROB, GEN_INT (prob)); + if (!find_reg_note (insn, REG_BR_PROB, 0)) +add_reg_note (insn, REG_BR_PROB, GEN_INT (prob)); } } Easwaran, could you please have a look at that? Does the change above make sense? While this would certainly make the error go away, it will be good to understand the root cause. If there is a REG_BR_PROB note already but the probability is different from what is passed to emit_cmp_and_jump_insn_1, should the existing value be replaced or left as such. Thanks, Easwaran
[Bug target/54938] sh libgcc_unpack_df.o fails to build: ../../../srcw/libgcc/fp-bit.h:221:19: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4273
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54938 --- Comment #5 from Oleg Endo olegendo at gcc dot gnu.org 2012-10-16 21:22:02 UTC --- (In reply to comment #4) In emit_cmp_and_jump_insn_1, the line gcc_assert (!find_reg_note (insn, REG_BR_PROB, 0)); blows up, because of config/sh/sh.c (expand_cbranchsi4): rtx jump = emit_jump_insn (branch_expander (operands[3])); if (probability = 0) add_reg_note (jump, REG_BR_PROB, GEN_INT (probability)); I am confused why this code causes the assert in emit_cmp_and_jump_insn_1. Summary: The backend attaches REG_BR_PROB notes when it expands cbranch patterns. The assumption in emit_cmp_and_jump_insn_1 is that no such notes have been attached yet. Could you please attach a stack trace? A simplified stack trace: ../../../srcw/libgcc/fp-bit.c: In function '__unpack_d': ../../../srcw/libgcc/fp-bit.c:442:1: internal compiler error: in emit_cmp_and_jump_insn_1, at optabs.c:4275 0x847036a emit_cmp_and_jump_insn_1 ../../gcc-trunk-van/gcc/optabs.c:4275 0x847036a emit_cmp_and_jump_insns(rtx_def*, rtx_def*, rtx_code, rtx_def*, machine_mode, int, rtx_def*, int) ../../gcc-trunk-van/gcc/optabs.c:4326 0x826e167 do_compare_rtx_and_jump(rtx_def*, rtx_def*, rtx_code, int, machine_mode, rtx_def*, rtx_def*, rtx_def*, int) ../../gcc-trunk-van/gcc/dojump.c:1072 0x826f680 do_jump(tree_node*, rtx_def*, rtx_def*, int) ../../gcc-trunk-van/gcc/dojump.c:591 0x8271a87 jumpifnot_1(tree_code, tree_node*, tree_node*, rtx_def*, int) ../../gcc-trunk-van/gcc/dojump.c:116 0x8211433 expand_gimple_cond ../../gcc-trunk-van/gcc/cfgexpand.c:1850 0x8219a47 expand_gimple_basic_block ../../gcc-trunk-van/gcc/cfgexpand.c:3830 0x821b337 gimple_expand_cfg ../../gcc-trunk-van/gcc/cfgexpand.c:4475 ... but it doesn't show where the REG_BR_PROB reg note comes from. What happens is that 'emit_cmp_and_jump_insn_1' invokes 'emit_jump_insn' which ends up expanding the cbranchsi4 insn in the backend's machine description. On SH, the cbranchsi4 expander invokes expand_cbranchsi4 (in sh.c), which attaches a REG_BR_PROB note. In case of SImode cbranch, the probability is always set to -1 and expand_cbranchsi4 does not attach a note. So no problem with this one. However, when it comes to DImode cbranch (cbranchdi4), SH's expand_cbranchdi4 will split expand the comparison into multiple SImode cbranch insns and attach REG_BR_PROB notes to them. After that it returns to emit_cmp_and_jump_insn_1 and the assert blows. If there is a REG_BR_PROB note already but the probability is different from what is passed to emit_cmp_and_jump_insn_1, should the existing value be replaced or left as such. Hm, or maybe try to accumulate the probabilities in some useful way? In this crashing case for the DImode comparison prob in emit_cmp_and_jump_insn_1 is 6100, and SH's expand_cbranchdi4 expands two cbranchsi4 insns, one with prob '-1' (i.e. no reg note), and another one with '0'.