public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/41993] [sh] ICE in create_pre_exit, at mode-switching.c:399 Date: Sun, 04 Nov 2012 16:46:00 -0000 [thread overview] Message-ID: <bug-41993-4-UDzie5tReR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-41993-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41993 --- Comment #4 from Uros Bizjak <ubizjak at gmail dot com> 2012-11-04 16:45:51 UTC --- I have looked a bit into this problem, since AVX vzeroupper insertion now depends on MODE_EXIT functionality. IMO, the patch in Comment #1 is correct for all optimization levels. The reason, the problem is triggered only at -O0 is that since __builtin_return loads from the memory, gcc emits offsets to memory locations using the pseudo: ... (insn 9 8 11 2 (set (reg:SI 0 r0) (mem:SI (reg/f:SI 163) [0 S4 A8])) pr41933.c:3 238 {movsi_ie} (nil)) (insn 11 9 12 2 (set (reg:SI 165) (mem/f/c:SI (plus:SI (reg/f:SI 162) (const_int 60 [0x3c])) [0 rframe+0 S4 A32])) pr41933.c:3 238 {movsi_ie} (nil)) (insn 12 11 13 2 (set (reg/f:SI 164) (plus:SI (reg:SI 165) (const_int 4 [0x4]))) pr41933.c:3 62 {*addsi3_compact} (nil)) (insn 13 12 10 2 (set (reg:SI 64 fr0) (mem:SI (reg/f:SI 164) [0 S4 A8])) pr41933.c:3 238 {movsi_ie} (nil)) (insn 10 13 14 2 (use (reg:SI 0 r0)) pr41933.c:3 -1 (nil)) (insn 14 10 22 2 (use (reg:SI 64 fr0)) pr41933.c:3 -1 (nil)) (insn 22 14 0 2 (use (reg/i:SI 0 r0)) pr41933.c:4 -1 (nil)) This additional pseudo is what breaks the compilation. At -O2, we enter mode-switching with: (note 4 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn 2 4 3 2 (set (reg/v/f:SI 161 [ rframe ]) (reg:SI 4 r4 [ rframe ])) pr41933.c:2 238 {movsi_ie} (expr_list:REG_DEAD (reg:SI 4 r4 [ rframe ]) (nil))) (note 3 2 6 2 NOTE_INSN_FUNCTION_BEG) (insn 6 3 8 2 (set (reg:SI 0 r0) (mem:SI (reg/v/f:SI 161 [ rframe ]) [0 S4 A8])) pr41933.c:3 238 {movsi_ie} (nil)) (insn 8 6 7 2 (set (reg:SI 64 fr0) (mem:SI (plus:SI (reg/v/f:SI 161 [ rframe ]) (const_int 4 [0x4])) [0 S4 A8])) pr41933.c:3 238 {movsi_ie} (expr_list:REG_DEAD (reg/v/f:SI 161 [ rframe ]) (nil))) (insn 7 8 9 2 (use (reg:SI 0 r0)) pr41933.c:3 -1 (nil)) (insn 9 7 17 2 (use (reg:SI 64 fr0)) pr41933.c:3 -1 (expr_list:REG_DEAD (reg:SI 64 fr0) (nil))) (insn 17 9 0 2 (use (reg/i:SI 0 r0)) pr41933.c:4 -1 (nil)) In this case, we found many return registers (due to __builtin_return), and consequently lowered nregs to zero. This satisfies the following assert in (!nregs) and (nregs != hard_regno_nregs[ret_start][GET_MODE (ret_reg)]) cases. In -O0 case, we broke discovery loop too early, so we can't find all return regs. I would argue, that we should ignore non-relevant pseudos with: --cut here-- Index: mode-switching.c =================================================================== --- mode-switching.c (revision 193133) +++ mode-switching.c (working copy) @@ -324,7 +324,10 @@ create_pre_exit (int n_entities, int *entity_map, else break; if (copy_start >= FIRST_PSEUDO_REGISTER) - break; + { + last_insn = return_copy; + continue; + } copy_num = hard_regno_nregs[copy_start][GET_MODE (copy_reg)]; --cut here-- In the same way as in case of i.e. UNSPEC_VOLATILE in the preceeding code.
next parent reply other threads:[~2012-11-04 16:46 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-41993-4@http.gcc.gnu.org/bugzilla/> 2012-11-04 16:46 ` ubizjak at gmail dot com [this message] 2012-11-05 9:14 ` kkojima at gcc dot gnu.org 2012-11-05 9:17 ` ubizjak at gmail dot com 2012-11-05 10:19 ` kkojima at gcc dot gnu.org 2012-11-06 9:17 ` kkojima at gcc dot gnu.org 2012-11-06 14:31 ` uros at gcc dot gnu.org 2012-11-07 23:24 ` kkojima at gcc dot gnu.org 2012-11-08 7:24 ` ubizjak at gmail dot com 2012-11-11 22:45 ` ubizjak at gmail dot com 2012-11-12 10:35 ` kkojima at gcc dot gnu.org 2012-11-12 20:21 ` olegendo at gcc dot gnu.org 2012-11-13 17:00 ` uros at gcc dot gnu.org 2009-11-09 3:18 [Bug c/41993] New: " iwamatsu at nigauri dot org 2009-11-11 21:59 ` [Bug target/41993] " kkojima at gcc dot gnu dot org 2009-11-17 2:56 ` iwamatsu at nigauri dot org 2009-11-17 22:24 ` kkojima at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-41993-4-UDzie5tReR@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).