From patchwork Sat Oct 1 00:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 1618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp52465wrs; Fri, 30 Sep 2022 17:58:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Of+DQ/n0UKIPSrXh0Bx/MhV/5QzP/7sqZWkzOwTW6gxcg7O9Apw/TokFDbMoSSa/DSjJu X-Received: by 2002:a17:907:1b1c:b0:72f:9aac:ee41 with SMTP id mp28-20020a1709071b1c00b0072f9aacee41mr8141954ejc.56.1664585888050; Fri, 30 Sep 2022 17:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664585888; cv=none; d=google.com; s=arc-20160816; b=ocSUQgALKBAxolCUAN5EsmHg5myeUZVjmIkPdwdpeVBxuE0xJvt5He0r1wXqhP8Ra6 LYJEZcA/sRUtzpNRcgPWSO69WD3U5bYcN5hWykl8b0sOJpdulkHJrI+kc2SQvflM28qy OeK92DXeMuLOH6GhyDnlSobmumWBaxFuVDzibmb13YRHfSB1BpxccCY1x5ErqrOs//sn nc9S7bL+pcFr3Fi73h60B3WZ97R3oYEFl3t18aX1M11xfWG2ZCVFcnRsdIjhvsD1Nrfg r8uSfxQ5rrPLMkfpieH4sp5q9MTITjyg1YOEJe/gNBWlFkTfVbCHdTqpD8D4VrsIOTcC vQyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:to:from :content-transfer-encoding:mime-version:message-id:date:subject :dkim-signature:dmarc-filter:delivered-to; bh=7NihSfwxekjwUIaAMF/GWDtmvx9ThNW7nx73z5vU6Jc=; b=KICJf9sD1BP+ohScRIEZBOnaMt0BHyFDmUc8eRr5lqfqm/zGSuvohh1kNEJdNcUCD7 74YWi1AfVzldC/YhIAw4Oh8aYrmNDcb1aPmNMSKOH+67f8z0EVXtEkIV11ThfWEruP9P qY1X9kvoCKnHuXBoqm4U62jMbI4FZ8fOCan0ylDZa0AWLR9maYXcNFNfHEwM8h71fbym 7uhnvKVBbv4UnZL/3xtgy0FwXH/9zUGatSIOId0bPZKtTEgiiz/nYIJEFNyz88kJopJr AE0CM/A6Huza5OryOzWfkYPF7lwhx2c81foSW0iMSW8+xVOxFHXz8k2e3OrQniCv8YYw bSSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="2QV3voT/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id o12-20020a170906974c00b0073db512d918si2744746ejy.765.2022.09.30.17.58.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 17:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=fail header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b="2QV3voT/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6309B385C33A for ; Sat, 1 Oct 2022 00:58:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id DAE893858D1E for ; Sat, 1 Oct 2022 00:57:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DAE893858D1E 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-pg1-x529.google.com with SMTP id 129so5466721pgc.5 for ; Fri, 30 Sep 2022 17:57:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:from:to:cc:subject:date; bh=7NihSfwxekjwUIaAMF/GWDtmvx9ThNW7nx73z5vU6Jc=; b=2QV3voT/jgyWhtQuE3EAGs0eQI3nHumOa0G1wkZXwAjb+83eOve/N9E2vau4QSVKPy gKYDhobIFeukQ9/eWcDRglEx1toseS67naBKSC25wNEFC8xygJzGTuLPV6FME1BPAvn/ JNHADVSO5uO68sJH0BxdpmQI+T9MTpFy2ZibVMg2qLH3BWFGZeOHleHt4q7DdxrhaSkk Rrgn6rRGwG6CtaL9EYZFqtySzbM6VGSOaWRc58z3ItbzF/E7XW80zkbs4wl9adjBiMBN G2nu4LbDEt5Pbs8dnY/RWdtUHSKSmNpLDqcTw4XO2ehnqyIvhSzQCMxE8gEpRnKZ0/Xz OIAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:from:cc:content-transfer-encoding:mime-version:message-id:date :subject:x-gm-message-state:from:to:cc:subject:date; bh=7NihSfwxekjwUIaAMF/GWDtmvx9ThNW7nx73z5vU6Jc=; b=MfbqXLs5g7zp1RIs9t6hDnrQnOMwYu3mX7tk5m8WpqyQYKjl2nbr/s87mPtNF5VXYc gFklyW+2Q8RtLW04tLKufNUHI9xi+DfZEADZsu72JpprQQdRIWaapjUQT8HrTv0LPu0r caUg9LvqAlOBp45USpZspR2ZSstJXqUol+7om/jRUusFKmwKdZ2bbTjnR6gHtlBy0Hc3 aZv2atWhu4gF57OiqGUbI24ABlyH7RkDixar4++FNKkhuaUhnO91LG+cVbXLOGZkhrse k/GduB+6L9ZE0YExZ7zyCuEjzupRr1rl+KVHHXqG1jK/k36/dEDFUpZgdnm30VQt/CQk 4K8A== X-Gm-Message-State: ACrzQf0mTg4QZ5xamg5/hiITCYjzzLGHe8ImdyZrAjkCS00oFq9B2qQE PUUK6nYogGqLKG/xu6c0y7bK+Q== X-Received: by 2002:aa7:88c9:0:b0:541:2b7:d655 with SMTP id k9-20020aa788c9000000b0054102b7d655mr11821367pff.72.1664585859580; Fri, 30 Sep 2022 17:57:39 -0700 (PDT) Received: from localhost (76-210-143-223.lightspeed.sntcca.sbcglobal.net. [76.210.143.223]) by smtp.gmail.com with ESMTPSA id t15-20020aa7946f000000b00555ba949f96sm2416404pfq.157.2022.09.30.17.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 17:57:39 -0700 (PDT) Subject: [PATCH] Fix the build of record_edge_info() Date: Fri, 30 Sep 2022 17:57:20 -0700 Message-Id: <20221001005720.28208-1-palmer@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 From: Palmer Dabbelt To: jeffreyalaw@gmail.com, gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1745444812189429790?= X-GMAIL-MSGID: =?utf-8?q?1745444812189429790?= As of 1214196da79 ("More gimple const/copy propagation opportunities"), I'm getting some build failures during bootstrap ../../gcc/tree-ssa-dom.cc: In function ‘void record_edge_info(basic_block)’: ../../gcc/tree-ssa-dom.cc:689:27: error: ‘dst’ was not declared in this scope; did you mean ‘dse’? 689 | if (dst == PHI_ARG_DEF (phi, !alternative)) | ^~~ | dse In file included from ../../gcc/gimple-ssa.h:24, from ../../gcc/ssa.h:27, from ../../gcc/tree-ssa-dom.cc:28: ../../gcc/tree-ssa-dom.cc:689:47: error: ‘phi’ was not declared in this scope; did you mean ‘gphi’? 689 | if (dst == PHI_ARG_DEF (phi, !alternative)) | ^~~ ../../gcc/tree-ssa-operands.h:82:54: note: in definition of macro ‘PHI_ARG_DEF’ 82 | #define PHI_ARG_DEF(PHI, I) gimple_phi_arg_def ((PHI), (I)) | I've never looked at this stuff before so I've sort of just pattern matched this, it at least fixes the build. Happy to go try and understand what's going on here, but I'm in the middle of a few things so I figured it'd be better to just send it along in case anyone else is running into the same issue -- it's more of a bug report than a fix, though. gcc/ChangeLog * tree-ssa-dom.c (record_edge_info): Move the alternative check below the phi definition. --- gcc/tree-ssa-dom.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc index 8d8312ca350..e6b8dace5e9 100644 --- a/gcc/tree-ssa-dom.cc +++ b/gcc/tree-ssa-dom.cc @@ -684,11 +684,6 @@ record_edge_info (basic_block bb) !gsi_end_p (gsi); gsi_next (&gsi)) { - /* If the other alternative is the same as the result, - then this is a degenerate and can be ignored. */ - if (dst == PHI_ARG_DEF (phi, !alternative)) - continue; - /* Now get the EDGE_INFO class so we can append it to our list. We want the successor edge where the destination is not the source of @@ -697,6 +692,11 @@ record_edge_info (basic_block bb) tree src = PHI_ARG_DEF (phi, alternative); tree dst = PHI_RESULT (phi); + /* If the other alternative is the same as the result, + then this is a degenerate and can be ignored. */ + if (dst == PHI_ARG_DEF (phi, !alternative)) + continue; + if (EDGE_SUCC (bb, 0)->dest != EDGE_PRED (bb, !alternative)->src) edge_info = (class edge_info *)EDGE_SUCC (bb, 0)->aux;