Message ID | 20220907142026.936922-1-stefansf@linux.ibm.com |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1166784wrt; Wed, 7 Sep 2022 07:21:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR5zIKDCksgoweAgaAFBR0fyr/q+zd2u8MdmtI9EcPmehwd2rfAstvMYyVYpaKqEQFI30gSK X-Received: by 2002:a17:907:b10:b0:76f:e74f:4f4c with SMTP id h16-20020a1709070b1000b0076fe74f4f4cmr2436236ejl.132.1662560494418; Wed, 07 Sep 2022 07:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662560494; cv=none; d=google.com; s=arc-20160816; b=xf6ZyKxr9qAdYU13T76TkHsedf36kcRX8/F4TvCQbCxFmq25YB2g0I0ME4dLpJZhCx OD5pNo76NtzT3gjhnStI2qnkMQUO2tN6R/TlPGSHb4+fssI7lwfbZCfX0ZYX9jJd1zMM BUuVvCkbkbbsMw/YhE6G5eS+n3CXyyxz0pOAczifToZ0Pqk+avz+cVVGbGugYrDQlXBk OnXWEZHJRILxRTnoArogC5fa6aD7qUoIST5J6ERPj6SXVL4d4WMWl4Nz5BY3CHBNT2Dx djyKXQOGM0SY69jPkCwUcBir7eA0JQKQeFCTBmbDzjhGCW+AwSO6jBBEqCR6lDI9Ky7I 4zOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=vnCJjlltPP+CDgY/i/dTmGCBnm5u8EuTMyVhru1NJ3Q=; b=uv27uqy5CDVoMEFppapi338v4cHSgX1tWgNyCjQgyxpiAVPTTWGWfVra241XEaA7hm gbpbKviItHZCgjWDTsjR5ZYUmWNCX1Yq3xmAfyhYRhjnrPXdPyIyVpWn2cqKWSfcwMI9 L6mEfPvtin2kHbx327lkCdzhe3U3EwiguqtzPDh3XqSTKbMLXQUXPy2Wi4JR4sdssB3N bg1YqZ+wcroQVgSFWMOdWZHS4dIL3Bi+08x8jDKYFvNeE75X/giNZ4bANPi5qKVarclO AE5tAVoMrCabWcNSmshBK0/GUMC14yrK09Y02TRWsWLozXyAaI3O6JM64KV2rXAW6Z3I /MXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b0+O9EZc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sa13-20020a1709076d0d00b007304f7a2b9fsi13017879ejc.558.2022.09.07.07.21.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 07:21:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=b0+O9EZc; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 99D743865486 for <ouuuleilei@gmail.com>; Wed, 7 Sep 2022 14:21:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99D743865486 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662560485; bh=vnCJjlltPP+CDgY/i/dTmGCBnm5u8EuTMyVhru1NJ3Q=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=b0+O9EZca1hvbOsQwuIG+rkcEJHS1RNvsum/wBffz2Mj1HQheA9GzO4uI1oVbUfwN aiy6ne70afLm6Spi4VTd5mcGwffeM8zoWhiMvCyXXUHyQjWRCBm/VZUnh8n50K89rg i75x1rPcUKX69VARcpH142fM3x4N24kBqdu8t9KU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id 61C12385841A for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 61C12385841A Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 287Dv4Nc005467 for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:40 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jevmugyhp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Wed, 07 Sep 2022 14:20:40 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 287E68VG021498 for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:37 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3jbxj8w9vc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for <gcc-patches@gcc.gnu.org>; Wed, 07 Sep 2022 14:20:37 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 287EKx4E42271158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:59 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6AECBA4051 for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:35 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D14FA4053 for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:35 +0000 (GMT) Received: from t8345026.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS for <gcc-patches@gcc.gnu.org>; Wed, 7 Sep 2022 14:20:35 +0000 (GMT) To: gcc-patches@gcc.gnu.org Subject: [PATCH 0/2] Variable tracking and subvalues Date: Wed, 7 Sep 2022 16:20:24 +0200 Message-Id: <20220907142026.936922-1-stefansf@linux.ibm.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KjVtKn7WGetpaavveiG30wIMh6GKB3eF X-Proofpoint-ORIG-GUID: KjVtKn7WGetpaavveiG30wIMh6GKB3eF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-07_07,2022-09-07_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 priorityscore=1501 bulkscore=0 clxscore=1015 suspectscore=0 mlxlogscore=585 lowpriorityscore=0 mlxscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209070055 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Stefan Schulze Frielinghaus via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743321032851638562?= X-GMAIL-MSGID: =?utf-8?q?1743321032851638562?= |
Series |
Variable tracking and subvalues
|
|
Message
Stefan Schulze Frielinghaus
Sept. 7, 2022, 2:20 p.m. UTC
For variable tracking there exists cases where a value is moved in a wider mode than its native mode. For example: int foo (int x) { bar (x); return x; } compiles on IBM zSystems into 0x00000000010012b0 <+0>: stmg %r12,%r15,96(%r15) 0x00000000010012b6 <+6>: lgr %r12,%r2 0x00000000010012ba <+10>: lay %r15,-160(%r15) 0x00000000010012c0 <+16>: brasl %r14,0x10012a0 <f1> 0x00000000010012c6 <+22>: lgr %r2,%r12 0x00000000010012ca <+26>: lmg %r12,%r15,256(%r15) 0x00000000010012d0 <+32>: br %r14 Initially variable x with SImode is held in register r2 which is moved to call-saved register r12 with DImode from where it is also restored. The cselib patch records that the initial value held in r2 is a subvalue of r12 which enables var-tracking to emit a register location entry: (gdb) info address x Symbol "x" is multi-location: Base address 0x10012b0 Range 0x10012b0-0x10012c5: a variable in $r2 Range 0x10012c5-0x10012d0: a variable in $r12 Range 0x10012d0-0x10012d2: a variable in $r2 However, this only works for straight-line programs and fails e.g. for __attribute__((noinline, noclone)) void fn1 (int x) { __asm volatile ("" : "+r" (x) : : "memory"); } __attribute__((noinline, noclone)) int fn2 (int x, int y) { if (x) { fn1 (x); // (*) fn1 (x); } return y; } __attribute__((noinline, noclone)) int fn3 (int x, int y) { return fn2 (x, y); } int main () { fn3 (36, 25); return 0; } At (*) variable x is moved into a call-saved register. However, the former cselib patch does not cover this since cselib flushes its tables across jumps. In order to not give up entirely by the second patch an entry value is referred. In summary this fixes the following guality tests for IBM zSystems: Fixed by cselib patch: FAIL: gcc.dg/guality/pr43051-1.c -O1 -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O3 -g -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O3 -g -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -Og -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -Og -DPREVENT_OPTIMIZATION line 40 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -O1 -DPREVENT_OPTIMIZATION line 40 v == 1 Fixed by var-tracking patch: FAIL: gcc.dg/guality/pr54519-1.c -O2 -DPREVENT_OPTIMIZATION line 23 x == 98 FAIL: gcc.dg/guality/pr54519-5.c -Og -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -DPREVENT_OPTIMIZATION line 20 x == 36 FAIL: gcc.dg/guality/pr54519-1.c -Og -DPREVENT_OPTIMIZATION line 20 x == 36 FAIL: gcc.dg/guality/pr54519-1.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -DPREVENT_OPTIMIZATION line 23 x == 98 FAIL: gcc.dg/guality/pr54551.c -O2 -flto -fno-use-linker-plugin -flto-partition=none -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54551.c -O3 -g -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54519-1.c -O1 -DPREVENT_OPTIMIZATION line 23 x == 98 FAIL: gcc.dg/guality/pr54551.c -Os -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54519-5.c -O1 -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-1.c -O1 -DPREVENT_OPTIMIZATION line 20 x == 36 FAIL: gcc.dg/guality/pr54519-4.c -Os -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-3.c -O3 -g -DPREVENT_OPTIMIZATION line 23 z == 8 FAIL: gcc.dg/guality/pr54551.c -O2 -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54551.c -O1 -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54519-1.c -O2 -DPREVENT_OPTIMIZATION line 20 x == 36 FAIL: gcc.dg/guality/pr54693-2.c -Os -DPREVENT_OPTIMIZATION line 21 x == 10 - i FAIL: gcc.dg/guality/pr54519-5.c -O2 -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-3.c -Os -DPREVENT_OPTIMIZATION line 20 z == 6 FAIL: gcc.dg/guality/pr54519-1.c -Og -DPREVENT_OPTIMIZATION line 23 x == 98 FAIL: gcc.dg/guality/pr54519-3.c -O2 -DPREVENT_OPTIMIZATION line 20 z == 6 FAIL: gcc.dg/guality/pr54551.c -Og -DPREVENT_OPTIMIZATION line 18 a == 4 FAIL: gcc.dg/guality/pr54519-3.c -O2 -DPREVENT_OPTIMIZATION line 23 z == 8 FAIL: gcc.dg/guality/pr54519-4.c -O2 -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-5.c -Os -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54693-2.c -O1 -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i FAIL: gcc.dg/guality/pr54519-4.c -O3 -g -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-5.c -O3 -g -DPREVENT_OPTIMIZATION line 17 y == 25 FAIL: gcc.dg/guality/pr54519-3.c -O3 -g -DPREVENT_OPTIMIZATION line 20 z == 6 FAIL: gcc.dg/guality/pr54519-3.c -Os -DPREVENT_OPTIMIZATION line 23 z == 8 FAIL: gcc.dg/guality/pr54693-2.c -O1 -DPREVENT_OPTIMIZATION line 21 x == 10 - i FAIL: gcc.dg/guality/pr54693-2.c -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions -DPREVENT_OPTIMIZATION line 21 y == 20 - 2 * i Fixed by cselib as well as var-tracking patches: FAIL: gcc.dg/guality/pr54519-1.c -Os -DPREVENT_OPTIMIZATION line 23 x == 98 FAIL: gcc.dg/guality/pr54519-1.c -Og -DPREVENT_OPTIMIZATION line 20 y == 25 FAIL: gcc.dg/guality/pr54519-1.c -O1 -DPREVENT_OPTIMIZATION line 20 y == 25 FAIL: gcc.dg/guality/pr54519-2.c -O1 -DPREVENT_OPTIMIZATION line 17 x == 6 FAIL: gcc.dg/guality/pr54519-5.c -O1 -DPREVENT_OPTIMIZATION line 17 x == 6 FAIL: gcc.dg/guality/pr54519-5.c -Og -DPREVENT_OPTIMIZATION line 17 x == 6 FAIL: gcc.dg/guality/pr54519-1.c -Os -DPREVENT_OPTIMIZATION line 20 x == 36 FAIL: gcc.dg/guality/pr54519-2.c -Og -DPREVENT_OPTIMIZATION line 17 x == 6 FAIL: gcc.dg/guality/pr54519-1.c -O1 -DPREVENT_OPTIMIZATION line 23 y == 117 FAIL: gcc.dg/guality/pr54519-1.c -Og -DPREVENT_OPTIMIZATION line 23 y == 117 Fixed only in conjunction of both patches: FAIL: gcc.dg/guality/pr43051-1.c -Os -DPREVENT_OPTIMIZATION line 35 v == 1 FAIL: gcc.dg/guality/pr43051-1.c -Os -DPREVENT_OPTIMIZATION line 40 v == 1 Bootstrapped and regtested on IBM zSystem as well as x86_64. Ok for mainline?