From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id E0F5A38582B8 for ; Tue, 20 Sep 2022 23:41:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E0F5A38582B8 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x135.google.com with SMTP id w8so6410330lft.12 for ; Tue, 20 Sep 2022 16:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:from:to:cc:subject:date; bh=MTClFTbu4XxmuQsQdnDNEBLxzAc6n/Q/XK40ZyL1nZk=; b=h18r6g94Gwibu55bpF6G/IScxL5Y410nU4JZuuuRfDwtkNmBMJJXfA/tUOV/7vhl7Y wEiFilCvvmISQF8ZNNX7IxqF4zQv6r0PRGrWHvA1DjF4I161trSuYTCx4s370gCaXU54 ju3Q3qXGSUFRVwVwCCcRPjscqKrKFkMjgNFP/xeMFnuXSrQygYOSJKPQ1ySQBfuuJknb n4y64lf+w7CJu8VWhDVKDZ78uR+y5cQklpG8NZzMroFo6pn2/w7jo6nfUJvCIfFOwh/g U6q9kf/s7RNE2znC3fTGT3bPHP4ZCkJG5kcTcBx4pkBKSuRNHPyTY1R4ePcZfqY8QIHy iW8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date; bh=MTClFTbu4XxmuQsQdnDNEBLxzAc6n/Q/XK40ZyL1nZk=; b=i3JLDnMDpi4FGNi8/xmTaLDcpTTLT+B7mKg7vYM3wdJPrcSFj6INB1sIvzDRkDPttD 4kkv9s1PG9ngcYHvzDS5aSsfxGQM5SsK7+F4G6uFuDCMuzln9dRPX5jTSM9Xmulmgzfq ggLfCkrDMl+h62fYmO6unR8UXMqzOrDp72rlQzNdmMSqirEwdvcPzkF9omFBKr7KzzVG 71TWUiWmucsCeS8r8tCyIldfZkBgXdODVtRoDCXOFeLAUqnZe3yydJLsp8vAZ0sSscj8 PJr5BHfIca8TqDRDkQgUg4m/TrRfcRA2J8eqxEr1cWBMImfchdNwherts5yA8rTPZF21 brYA== X-Gm-Message-State: ACrzQf2ylXqblDSfYH+6ZhI8MIj0tG5r5WN2xIDVm3dYViSr/Jyy8/6K 7n+u75Lmi7x9eJRsp10M2D0= X-Google-Smtp-Source: AMsMyM41b7vaaLfcXCw1VtxpqyGUp1mchLixqDnnUGeDeLoj19lTyXWQtkse7FB+blGEQi/qKjnvgQ== X-Received: by 2002:a05:6512:b18:b0:49f:585b:c1f0 with SMTP id w24-20020a0565120b1800b0049f585bc1f0mr8594166lfu.293.1663717265133; Tue, 20 Sep 2022 16:41:05 -0700 (PDT) Received: from [192.168.0.14] (c83-254-134-90.bredband.tele2.se. [83.254.134.90]) by smtp.gmail.com with ESMTPSA id 10-20020a2e060a000000b0026ab2a04055sm156279ljg.130.2022.09.20.16.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 16:41:04 -0700 (PDT) From: Krister Walfridsson X-Google-Original-From: Krister Walfridsson Date: Tue, 20 Sep 2022 23:40:51 +0000 (UTC) To: Richard Biener cc: gcc@gcc.gnu.org Subject: Re: Translation validation In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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: On Wed, 14 Sep 2022, Richard Biener wrote: > Note that the folding/peephole optimizations done early can be avoided > when you separate opportunities in the source to multiple statements, > like change > > int a, b; > a = b + 1 - b; > > to > > a = b + 1; > a = a - b; > > note that parts of the folding optimizations are shared between GENERIC > and GIMPLE (those generated from match.pd), so those will be exercised. > Fully exercising and verifying the fold-const.cc only optimizations which > happen on GENERIC only is indeed going to be difficult. > > Another way to avoid some of the pre-SSA optimizations is to feed the > plugin with input from the GIMPLE frontend. Look at > gcc/testsuite/gcc.dg/gimplefe-*.c for examples, IL can be dumped > roughly in a format suitable as GIMPLE frontend input by dumping > with -fdump-tree--gimple (but note all type, global variable and function > declarations are missing ...) This does not help when trying to find wrong-code bugs by compiling random source code with plugin1.py. :( But it helps when writing tests for plugin2.py, so I wrote a simple script that extracts the first operand from match.pd simplify expressions and uses that to generate test cases. For example, (simplify (mult (abs@1 @0) @1) (mult @0 @0)) is generated as int __GIMPLE () f (int a0) { int _0; int a1; int _2; int _3; _2 = a0; a1 = __ABS _2; _3 = a1; _0 = a1 * _3; return _0; } This is not an optimal way to find bugs as many of the simplify expressions have additional restrictions in the replacement part, so many of my generated functions fail to trigger optimizations... This did not find any wrong-code bugs, but it found two cases where match.pd is missing TYPE_OVERFLOW_SANITIZED checks: PR 106990. /Krister