public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Henri Cloetens <henri.cloetens@blueice.be>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Issue during combine.
Date: Mon, 19 Oct 2020 21:56:04 +0200	[thread overview]
Message-ID: <7eb8f9b2-1960-634e-7f62-6dfc35077ff5@blueice.be> (raw)
In-Reply-To: <20201019192839.GR2672@gate.crashing.org>

Hello Segher, Dan, all,

The issue is following:
(as far as I understand it.)

- There are 2 instructions, they are combined by the combiner.
- As correctly stated by you, the combiner tries these, to see if it 
makes sense.
- Of course, it should not make sense, and should be rejected.
- However, during the "checking", the combiner calls "simplify_subreg" 
in simplify-rtx.c.
- There, it crashes on "/gcc_assert(innermode != VOIDmode)/.
- Please look at the rtx, and how this is combined. This 'mistake' is 
created by the combiner. Combining the RTX (see below),
    it changed the expression
/(set (...) (subreg:qi(reg: si 197,0)))
/into
/(set (...) )subreg:qi(if_then_else ...
/Apparently, the /if_then_else/ - operator not being subreggable, this 
is recognized as VOIDmode, causing simplify_subreg to crash.
- I fixed it by causing the subroutine to fail (= tell "this expression 
cannot be simplified"), instead of crash by adding a statement.
- If you want me to submit it, well, simplify the test case that is 
still possible, but ... how should I submit the custom back-end ?.
   (I am willing to do it, but does it make sense ?.)

Best Regards,

Henri.
*BELOW/:/*/routine simplify_subreg/ and the relevant rtx statements 
before and after combine.
//
/rtx//
//simplify_subreg (machine_mode outermode, rtx op,//
//                 machine_mode innermode, poly_uint64 byte)//
//{/*
/if(innermode == VOIDmode) return(0) ; // MY BUG//FIX/
*/gcc_assert(innermode != VOIDmode)/

Before combine:

/(insn 2354 2352 1743 175 (set (reg/v:SI 197 [ dig ])//
//        (if_then_else (eq (subreg:QI (reg:SI 632) 1)//
//                (const_int 1 [0x1]))//
//            (reg:SI 708)//
//            (reg/v:SI 197 [ dig ]))) 
"/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":771:6 35 
{select_internal3}//
//     (expr_list:REG_DEAD (reg:SI 708)//
//        (expr_list:REG_DEAD (reg:SI 632)//
//            (nil))))//
//(insn 1743 2354 124 175 (set (mem:QI (reg:SI 316 [ ivtmp.118 ]) [0 
*s_304+0 S1 A8])//
//        (subreg:QI (reg/v:SI 197 [ dig ]) 0)) 
"/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":772:13 6 
{movqi_internal}//
//     (expr_list:REG_DEAD (reg:SI 316 [ ivtmp.118 ])//
//        (expr_list:REG_DEAD (reg/v:SI 197 [ dig ])//
//            (nil))))/

This is during the combine-step transformed into:

/(insn 1743 2354 124 175 (set (mem:QI (reg:SI 316 [ ivtmp.118 ]) [0 
*s_304+0 S1 A8])//
//        (subreg:QI (if_then_else (eq (subreg:QI (reg:SI 632) 1)//
//                    (const_int 1 [0x1]))//
//                (reg:SI 708)//
//                (reg/v:SI 197 [ dig ])) 0)) 
"/home/henri/blueICe/gcc/newlib/newlib/libc/stdlib/dtoa.c":772:13 6 
{movqi_internal}//
//     (expr_list:REG_DEAD (reg:SI 316 [ ivtmp.118 ])//
//        (expr_list:REG_DEAD (reg/v:SI 197 [ dig ])//
//            (nil))))/






  reply	other threads:[~2020-10-19 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 12:53 Henri Cloetens
2020-10-19 15:55 ` Henri Cloetens
2020-10-19 19:28   ` Segher Boessenkool
2020-10-19 19:56     ` Henri Cloetens [this message]
2020-10-19 21:20       ` Segher Boessenkool
2020-10-20 13:19 ` Richard Earnshaw
2020-10-20 15:01   ` Henri Cloetens
2020-10-20 15:48     ` Segher Boessenkool

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=7eb8f9b2-1960-634e-7f62-6dfc35077ff5@blueice.be \
    --to=henri.cloetens@blueice.be \
    --cc=gcc-help@gcc.gnu.org \
    --cc=segher@kernel.crashing.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: link
Be 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).