From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by sourceware.org (Postfix) with ESMTPS id 0D6743858404 for ; Thu, 6 Oct 2022 22:57:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0D6743858404 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-qt1-x831.google.com with SMTP id ay9so1950098qtb.0 for ; Thu, 06 Oct 2022 15:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ropjg3cZT6vgEdOgjRVXflHccKbmU/bPej023piJDMY=; b=V20o363Ir5bbo8X+js5uBxHMi1D9SaFxcRZB6QWuJCYI0T72/rq+s+By31K27eCuz8 2FixceakyUhm20bVh82BguLiDDj9ymVXnTopVGoQ6QkYT9rMncNYMJeY484pee+wokll il5DJfKPaEraqaQv6F4ZMSMr+KlTwv3xxOMPpMxpm4bURrN4kChPWiLbXbjNh/T4y95M tOhP/x9ciNRbHIFB2IvjA0aR9FB/yn9Ub6pk2/uVbMumaU2Z+7iGLnQg4EdviSDE6Ych AFL7CXdc7YDCLcIcgtJNeGTDV7tQsGoJZ3lOwQQun5FILt/5uC+snjqblsDYsIv/8FzV axvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=ropjg3cZT6vgEdOgjRVXflHccKbmU/bPej023piJDMY=; b=YXh5Omkmdo3+IooyyvE13GLSyiZQFYRVVaSLelkxT/O9PCfNjDfiOwmAP1s/z78NVL nCPJLAdfTff/72jb4UzKA4uykfkvZHCqwq2gXMPgaE3enqzORmX3qDheFI+0M8w5QwVX TlGYGtIyPWS0H6rYtbC4XHqEmkhe86fgVBDtnuriICmakAZ0mo5tEFKpoquKgrOM84J2 jjYX3cZafxCiMHS0wtmwXR5tL/53JFiHSO3XTdy7t7JKDaTfcu8TGaw7n37EyBB/Wno7 4BkUD5FY6qnxXmmbdWDRNWjVqoPtQuCNYL1NvFXon13ioONDbeWH90kITbQXMgKvJa2v rBIg== X-Gm-Message-State: ACrzQf1NWlZe197HSpf3hijjdKXCPNuw4qCpZFb8Ua4LOGJxMSaP558H lq0IRWNnoXUGFWBNNSvUIRWEw/sCZXoy/h8k X-Google-Smtp-Source: AMsMyM4HMwmZqr5psPMAP3CD8AHco/xCyeOocB5b56HBDKzIumZR7AvSLvS/EEI0N2Z9OoIxAYtcAQ== X-Received: by 2002:a05:622a:1194:b0:35b:bc30:e928 with SMTP id m20-20020a05622a119400b0035bbc30e928mr2248313qtk.256.1665097061278; Thu, 06 Oct 2022 15:57:41 -0700 (PDT) Received: from [192.168.86.117] ([136.57.172.92]) by smtp.gmail.com with ESMTPSA id ey23-20020a05622a4c1700b0035cf31005e2sm708492qtb.73.2022.10.06.15.57.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Oct 2022 15:57:40 -0700 (PDT) Message-ID: Date: Thu, 6 Oct 2022 18:57:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: gcc@gcc.gnu.org From: Michael Collison Subject: Need help with match.pd crash Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: I am trying to improve code generation for coremark to match a recent improvement that was made in LLVM. I added the following transformation to match.pd which attempts to replace a branch with straight line code: /* (cond (and (x , 0x1) == 0), y, (z ^ y) ) -> (-(and (x , 0x1)) & z ) ^ y */ (simplify     (cond (eq (bit_and @0 integer_onep@1)                  integer_zerop)          @2          (bit_xor:c @3 @2))         (bit_xor (bit_and (negate (bit_and @0 @1)) @3) @2)) I get a internal error, but in stepping through the debugger I can see the pattern matches, but fails when when it tries to further simplify and match another pattern in match.pd: /* x & C -> x if we know that x & ~C == 0.  */ #if GIMPLE (simplify  (bit_and SSA_NAME@0 INTEGER_CST@1)  (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))       && wi::bit_and_not (get_nonzero_bits (@0), wi::to_wide (@1)) == 0)   @0)) #endif The crash occurs in wi::bit_and_not. Before digging further I want to ask if there is a problem with the way I wrote the transformation?