From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ln01.mxout.alfaservers.com (ln01.mxout.alfaservers.com [85.17.185.57]) by sourceware.org (Postfix) with ESMTPS id 5582B388701C for ; Mon, 19 Oct 2020 19:54:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5582B388701C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=blueice.be Authentication-Results: sourceware.org; spf=none smtp.mailfrom=henri.cloetens@blueice.be Received: from [193.121.150.145] (port=46414 helo=[192.168.178.60]) by ln01.alfaservers.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1kUbF8-0000MZ-U8; Mon, 19 Oct 2020 21:54:54 +0200 Subject: Re: Issue during combine. To: Segher Boessenkool Cc: gcc-help@gcc.gnu.org References: <2ade57f1-ff38-553c-0e06-1cbb445f5d4e@blueice.be> <20201019192839.GR2672@gate.crashing.org> From: Henri Cloetens Message-ID: <7eb8f9b2-1960-634e-7f62-6dfc35077ff5@blueice.be> Date: Mon, 19 Oct 2020 21:56:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20201019192839.GR2672@gate.crashing.org> Content-Language: en-MW X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ln01.alfaservers.com X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - blueice.be X-Get-Message-Sender-Via: ln01.alfaservers.com: authenticated_id: henri.cloetens@blueice.be X-Authenticated-Sender: ln01.alfaservers.com: henri.cloetens@blueice.be X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00, BODY_8BITS, HTML_MESSAGE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2020 19:54:57 -0000 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))))/