From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AMsMyM4VDI9c9xlYF+4s0Hn/+L9IH84it+xYF9GifN6dnWlf9NTlB7oO8iUTCpxWL57KAqz9R587AQ== 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Palmer Dabbelt 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 List-Id: 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; -- 2.34.1