From patchwork Mon Nov 6 07:39:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamar Christina X-Patchwork-Id: 161851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp2496076vqu; Sun, 5 Nov 2023 23:40:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHnB3Jx9IZy+OBha5+zMRZQwY8CuIR4TJeHD5PqwkO5wasYHv8Vzhy43pI18PuzrYLV31RE X-Received: by 2002:ac8:7d04:0:b0:41e:2aab:8dc with SMTP id g4-20020ac87d04000000b0041e2aab08dcmr32281597qtb.37.1699256412455; Sun, 05 Nov 2023 23:40:12 -0800 (PST) ARC-Seal: i=4; a=rsa-sha256; t=1699256412; cv=pass; d=google.com; s=arc-20160816; b=j6wTV+LlKIWU/aBiDHKsax5C/tiPHX12jTRmI9xYdNWgXM+jmMRgX6ss/cIP4ter44 lVrW+zTcl5ySgrrMXXLGev9u2xAy4huxoWf1P6jijR37R2TgcJCACuqJhwq+vHGEFfQg 3k8xtMS6HLwd5iNJl2Tfa38tT2J3qkIzIkmB9Kyefz5ybjLBCu5Ihl6EanZcB7oS0KPo 6O6ugncf5dz9Sc57dXiIl+87c4fEHQr/gZNT4LXeuJacHdAlyBTWc6MEOlznwptR8Ric amlcSDSjzR6IRSvLPC2ezilOYFfVQczPG7ek9LroxQySdEX7NYaMoRlQ0hNRDplxpc4n /UxA== ARC-Message-Signature: i=4; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:original-authentication-results :nodisclaimer:mime-version:in-reply-to:content-disposition :message-id:subject:cc:to:from:date:authentication-results-original :dkim-signature:dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=EABoulHZFs0j2pX9/rKqdGes5RkETp0UgEmwfoSm4h0=; fh=6lLuKcPp5JwcfhLsQ40FQN1vJS1KxlKbf2GiViQwbCM=; b=EBkjVeJXUFWe+XEq6aAerM4A4IgdIu1raKiF6Z9DsvarIAOVv/AzmH/LhoEjJLURsF bQhUw+zc4TqSBXi3LsFgebrkVeClOfI5f3Q6Y++zsloYvVORavTaEp37W9aAd7DZ7BiY zdgooS2MWYumggtqDVwUEvCa+unv2de1o0YFxQPBt/YBx3CRe1Je3eCgAbxDhRTW7M8f A8QKWnlW4fP6WrkgMjgKPZrZ6kE8P5Np3Nicv7P2oRnrOUxiBthn6lHT4Fx0ugVfQQ4M MnURvjpH3ZLkud2Ph0kjJrBA9s849pduLHP6/FNK4EQOs0RsR9ydImPoPz/No250jtjg rz2g== ARC-Authentication-Results: i=4; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=SWdIGBv2; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=SWdIGBv2; arc=pass (i=3); 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id w13-20020a05622a190d00b0041202f5992asi5380588qtc.96.2023.11.05.23.40.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 23:40:12 -0800 (PST) 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=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=SWdIGBv2; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=SWdIGBv2; arc=pass (i=3); 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"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90810386181F for ; Mon, 6 Nov 2023 07:39:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.78]) by sourceware.org (Postfix) with ESMTPS id 2F6363856943 for ; Mon, 6 Nov 2023 07:39:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F6363856943 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2F6363856943 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.21.78 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699256368; cv=pass; b=wsZuTH2n1SwPhuYoQl9Nmz3ZE+xksCnprObqiQAjeI/mlbDpe2y1mQIH8vQbTeGZ0LY6DgbC5+biMGNiTQTcsgbiGQyWvbzG84ALExi+RoPgEqsZQx+UgmOxNddk+20sjb8QhkK+n1M7bfvy7bpjVNPp32vCwqtElFI1bxTO3cY= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1699256368; c=relaxed/simple; bh=YYEUsAQi89wk9fuRoXxpcr3YhkV7w39g0U/eMIrK4lQ=; h=DKIM-Signature:DKIM-Signature:Date:From:To:Subject:Message-ID: MIME-Version; b=Mey6E7Qbn6YSUHs4WAZmcCAwFPtaPkTsnJtSYE9MZ43GjBHzOx33Iw3s4YSfS5cBW7srwAlNMfqKvhPdv6iivZGvaYnxkgVu5gV+VLumFNYRUk6bG7b8e8bg5JveM8riN+RI7pqU4/5P6mk5vzNT3ogH68JlRIccFE9GiZNn9GI= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=CHwa7tilt05j2AJc00CBIfT4drny6YHXi6i7sev1y/9fsIfdfmmdOsbU6xcn7wFg/fQsq3HvjAvWSqi3dISjM3XqFdvN4M3PTE0VcFdZKWKRv9yNQUtkXS0OgHDv+Xpttd0I6uM/POzQy3rM442hYFowE+/5sS69U/PCsQa3EhaeiSzDL/5mS6q/+eG7Ao+Iivi31O0w1ZCURYDjb4SW50Y/buY1IIRsLKRTwY0cTZHuZfCNp8M5D+UpODYNVKrOGm7TBUrPzPBXxNxiXmVKs/Y9bGplZi/huSbkVBRkJIIdWIi1Sa5x6pSRiSdGMU35wekyJYYFWXGd5n4bDa4vCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EABoulHZFs0j2pX9/rKqdGes5RkETp0UgEmwfoSm4h0=; b=E+yvhWFZQ4U2Thq6WHQJhZok0ucb65A4swQgjI+3pYJmNnPpk18ar7/qM9ME79DMw49DMazPQ6EtczMrtufaEzTHQzHqvfObmDV0H17mrsLEJiWvEL0LLIoNT+xcb/cHpxCTEA0tYNfqSWtvlBamPCXXEf9sGWm052+3lJH9WUGoZaeIJMZe9UDMMCkkxct3kf6LlB1LbB8NvvRM20eplfW2zzkVBs7RwU2MmvqR4OP2nP7xduYqfasR4VL26r5961gPhTc/8ZW/X4jGT/yYgifiJi+E53ZO9/sjIhXpu8IMH1iAlRqCKwKl6hWUaNJd+qoY1MCzg5i4tOiQoxZONA== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EABoulHZFs0j2pX9/rKqdGes5RkETp0UgEmwfoSm4h0=; b=SWdIGBv2EAZmc4r75N57JAMKUl7Gc0anBgZz5s0SF5RZ5f7WxZw0e0jX0ALR8lykwU95KlHFsMffBIIAZgPq+vkNvr+EZ4IVz4CBLYfGaM1Dk08Yn4MBYMKSlkEhKg5IzrwJpIqmgfWfsPKu/5ZWeY3bok0yjXwBlDrYuVM7D3Y= Received: from AM0PR03CA0060.eurprd03.prod.outlook.com (2603:10a6:208::37) by DU0PR08MB8881.eurprd08.prod.outlook.com (2603:10a6:10:47c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.27; Mon, 6 Nov 2023 07:39:19 +0000 Received: from AM4PEPF00025F9C.EURPRD83.prod.outlook.com (2603:10a6:208:0:cafe::7e) by AM0PR03CA0060.outlook.office365.com (2603:10a6:208::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28 via Frontend Transport; Mon, 6 Nov 2023 07:39:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM4PEPF00025F9C.mail.protection.outlook.com (10.167.16.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.1 via Frontend Transport; Mon, 6 Nov 2023 07:39:19 +0000 Received: ("Tessian outbound 385ad2f98d71:v228"); Mon, 06 Nov 2023 07:39:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 2f581f4bd830bfdb X-CR-MTA-TID: 64aa7808 Received: from 17171f95b415.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 298D7A60-B829-4BFE-A388-99BB33D19076.1; Mon, 06 Nov 2023 07:39:12 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 17171f95b415.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 06 Nov 2023 07:39:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dszyRNgLLnz1PYgWNAsWMklkI6DLTm4OWKO06ViTxqIe2/5dkUnc3PuARL1fR8u2Y0noLG/JhEjbrUmUXlo/nLIWU8/9xsytxUUbOHAT/hGNrqj76VwJ8Gvjow4hgjWa5LASeF4pHqMk+XCJh7FfKt42HAXhmLTKsZQf1vdgF+hJsDBqKDqsw7fqEm4eX0vlYRkXH1XT0gqZg0zAVUdyAD+LP7Er2xMqvicoRi5k+3hgHM9Wh6bcVUqGUGgeCdn0prD/CxVYSoOXUAmEcMZp+v3R2EMGcuv4RdBaL3+OoQepL0GlTWR9lu/BSeDv2dGsjd6R+WX/jncC+GMz6lTxRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EABoulHZFs0j2pX9/rKqdGes5RkETp0UgEmwfoSm4h0=; b=fDpopebWaxQ/EN2oVFXrLp69ACJLnQWLcxs/utaa3mYmLJ6D9NruKWTssChZeNL9mnFKvDRNQtRfe0kr53T3MWrgYexnKP1fWkLb1fzNEM2O/q5dwrLjycwLOyDie1rSzrVUxAPvGIJlGzZX/OmyukY7dnTndabANKGUQvOOxsNatbRJ0LsjGVyDdKObwupPF44be+fhzdp+6STzUeWNE8svscXJWKlPNeb21uyD61WPaf7F7/NKsZ4umizYt5Twn6ALHPiFrrHJKof7np7gu6HoEvRn8ZIv6BHpKqHG4RtmCSekwHXoWaV5B7BOKdqmXnBaROgx7mxTpOSq+DFflw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EABoulHZFs0j2pX9/rKqdGes5RkETp0UgEmwfoSm4h0=; b=SWdIGBv2EAZmc4r75N57JAMKUl7Gc0anBgZz5s0SF5RZ5f7WxZw0e0jX0ALR8lykwU95KlHFsMffBIIAZgPq+vkNvr+EZ4IVz4CBLYfGaM1Dk08Yn4MBYMKSlkEhKg5IzrwJpIqmgfWfsPKu/5ZWeY3bok0yjXwBlDrYuVM7D3Y= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) by DBBPR08MB10676.eurprd08.prod.outlook.com (2603:10a6:10:530::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Mon, 6 Nov 2023 07:39:09 +0000 Received: from VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::26aa:efdd:a74a:27d0]) by VI1PR08MB5325.eurprd08.prod.outlook.com ([fe80::26aa:efdd:a74a:27d0%5]) with mapi id 15.20.6954.028; Mon, 6 Nov 2023 07:39:09 +0000 Date: Mon, 6 Nov 2023 07:39:07 +0000 From: Tamar Christina To: gcc-patches@gcc.gnu.org Cc: nd@arm.com, rguenther@suse.de, jlaw@ventanamicro.com Subject: [PATCH 7/21]middle-end: update IV update code to support early breaks and arbitrary exits Message-ID: Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P265CA0038.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::6) To VI1PR08MB5325.eurprd08.prod.outlook.com (2603:10a6:803:13e::17) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB5325:EE_|DBBPR08MB10676:EE_|AM4PEPF00025F9C:EE_|DU0PR08MB8881:EE_ X-MS-Office365-Filtering-Correlation-Id: dcde56bb-f115-4988-045d-08dbde9b7c6e x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WNYVHLs11kpCNnig9hXl5XPisfFzCZVHMGtb07/CutEj7vHUPh6pf9n8aecyplkE/UcyaH1wWez7sxDx0r1uUsu/vh0c4Uda8MhXtUgYdk5jltGwmtXXgTk/Mv4YreEzAR+HZicC3s/2AIvSHEL8VxsaZj768Ps+cgg/wkEOnJHJMpbapU+ZIqmcqh3qCcZEvYePSOEHDvB9uhAHTm1wOsxwxTc77sRNE/MbqOd1ehpMRroLsCJ6+KdQA5vrTKKUJAITl69dXrQOO/lQmjlpzIwfDfhygAb5kYzchNBYdLVEbGRKOrhSn+Gz3/K40OmQzXYfxuuRRg2FspBNn/5bQfVG7P232njzc0Cz9hCbN3evOE72eyJM9K5AuGt+BWLB09w2ShJiD3vKhVet5FRHa7Ud0mo2WO74r/DabqlqfElXPiLCLbI3NL65Nc/2vbMSzuS5zKhcrWlheFpRC5QfJluR0TXcdbIrquUhDOcUt+fm1J4s3q8JT+uZ94Zq/9S5ould1CpDuwIDV3SgGhxfBkBpF3j0o6hxiEwulhT9mt3ue0xgagxN888KsQumCFzFH1jhg+tbiio/1Rd2QXsqMvv/3RxU+wy9/YzhnrlUAOA= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB5325.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(396003)(376002)(366004)(346002)(39860400002)(230922051799003)(186009)(64100799003)(1800799009)(451199024)(6916009)(4326008)(8676002)(8936002)(41300700001)(36756003)(2906002)(235185007)(38100700002)(5660300002)(6486002)(66899024)(966005)(66556008)(6512007)(316002)(66476007)(86362001)(44832011)(15650500001)(4743002)(66946007)(83380400001)(26005)(2616005)(6506007)(478600001)(33964004)(44144004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10676 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM4PEPF00025F9C.EURPRD83.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 440b94c7-e18b-4304-3554-08dbde9b767f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wNVXgUtnHq8x1o9Epl3eFIwv057NMqy7egYgtp/XySeTyc3MSXXwKL6DBJ5PvwDXvaPtOI6ZsWk74Cv8o9MiDbYgFBLUpXlzPloeEJa21XwJZ7exjEMFQxfWc/82HCYCogwKOC07ybBlqywhCHCGlGZRkCKVkM0MJrq0lri2uJaR52IAGrGRAAGVItgXy7xSL6bTGuEtE6HkHEqY/GEjfhbSGnHvVdqvnSUHxnCj7JZU2F3GNqARobiOlhymTI965KXf/eeH9cMNHf2HwpNQPfq+WwVKwTD3MsegXS7lyzihlhnzrCa49tVXeuJNI0izi3M3XhrWITlIAEiE/eq8wgky/oCpdj2AFTeDlO+qh8+zRfE4P/9R4h6NXlYuRiw8xBW47rn+FeIJr8bZAo4R8Ul6W3smEPpbfY85nAla4BAdv6rMVLpUS/gAxhekP+KhNX0KCi3/SFeatHeuaNIQzWNMyIcWYiYqcYwlr42LODtgRSYVaHKgNEr0bwXogcPQamibQty63m4Z6heP5LmRmkJgEtANsUNdbU+9e+ISyGsbYtOh7v3PwQWkth5yHZ3tEF4Mg1XaOM9XldtIiJUMGrCOCFWk/Pc5X3gTLwkS9gK2Y1qcNAEIhZaanqd4+RDEpFweX8JtVU73FMhuMLpdrxUS2FCo1ZILkZKWuezfhY+XKMgASDvRP+vNt8pX4gXyNpAfhChJ2LG2rpEEt64MSuV4QuvUDFpaiJwCchkOLtbghThyzGKykgx5BcCW3Tf0lLClcDPC6KPgDj6Uz/TyXw== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230031)(4636009)(396003)(136003)(346002)(376002)(39860400002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(6506007)(44144004)(33964004)(4326008)(8676002)(44832011)(478600001)(6486002)(966005)(8936002)(107886003)(6512007)(41300700001)(2616005)(316002)(6916009)(70206006)(70586007)(5660300002)(235185007)(4743002)(336012)(2906002)(83380400001)(40460700003)(66899024)(26005)(15650500001)(47076005)(356005)(82740400003)(81166007)(36860700001)(40480700001)(86362001)(36756003)(2700100001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2023 07:39:19.1314 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dcde56bb-f115-4988-045d-08dbde9b7c6e X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00025F9C.EURPRD83.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8881 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY 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.30 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781799491715332275 X-GMAIL-MSGID: 1781799491715332275 Hi All, This changes the PHI node updates to support early breaks. It has to support both the case where the loop's exit matches the normal loop exit and one where the early exit is "inverted", i.e. it's an early exit edge. In the latter case we must always restart the loop for VF iterations. For an early exit the reason is obvious, but there are cases where the "normal" exit is located before the early one. This exit then does a check on ivtmp resulting in us leaving the loop since it thinks we're done. In these case we may still have side-effects to perform so we also go to the scalar loop. For the "normal" exit niters has already been adjusted for peeling, for the early exits we must find out how many iterations we actually did. So we have to recalculate the new position for each exit. This works, however ./gcc/testsuite/gcc.dg/vect/vect-early-break_76.c is currently giving me a runtime failure, but I cannot seem to tell why. The generated control looks correct to me, See loop 1: https://gist.github.com/Mistuke/78b439de05e303ac6de5438dd83f079b Any help in pointing out the mistake is appreciated. Thanks, Tamar gcc/ChangeLog: * tree-vect-loop-manip.cc (vect_set_loop_condition_normal): Hide unused. (vect_is_loop_exit_latch_pred): Mark inline (vect_update_ivs_after_vectorizer): Support early break. (vect_do_peeling): Use it. (find_guard_arg): Keep the same value. --- inline copy of patch -- diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 58b4b9c11d8b844ee86156cdfcba7f838030a7c2..abd905b78f3661f80168c3866d7c3e68a9c15521 100644 --- diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 58b4b9c11d8b844ee86156cdfcba7f838030a7c2..abd905b78f3661f80168c3866d7c3e68a9c15521 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1187,7 +1187,7 @@ vect_set_loop_condition_partial_vectors_avx512 (class loop *loop, loop handles exactly VF scalars per iteration. */ static gcond * -vect_set_loop_condition_normal (loop_vec_info loop_vinfo, edge exit_edge, +vect_set_loop_condition_normal (loop_vec_info /* loop_vinfo */, edge exit_edge, class loop *loop, tree niters, tree step, tree final_iv, bool niters_maybe_zero, gimple_stmt_iterator loop_cond_gsi) @@ -1452,7 +1452,7 @@ slpeel_duplicate_current_defs_from_edges (edge from, edge to) When this happens we need to flip the understanding of main and other exits by peeling and IV updates. */ -bool +bool inline vect_is_loop_exit_latch_pred (edge loop_exit, class loop *loop) { return single_pred (loop->latch) == loop_exit->src; @@ -2193,6 +2193,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) Input: - LOOP - a loop that is going to be vectorized. The last few iterations of LOOP were peeled. + - VF - The chosen vectorization factor for LOOP. - NITERS - the number of iterations that LOOP executes (before it is vectorized). i.e, the number of times the ivs should be bumped. - UPDATE_E - a successor edge of LOOP->exit that is on the (only) path @@ -2203,6 +2204,9 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) The phi args associated with the edge UPDATE_E in the bb UPDATE_E->dest are updated accordingly. + - MAIN_EXIT_P - Indicates whether UPDATE_E is twhat the vectorizer + considers the main loop exit. + Assumption 1: Like the rest of the vectorizer, this function assumes a single loop exit that has a single predecessor. @@ -2220,18 +2224,21 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) */ static void -vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, - tree niters, edge update_e) +vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, poly_uint64 vf, + tree niters, edge update_e, bool main_exit_p) { gphi_iterator gsi, gsi1; class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); basic_block update_bb = update_e->dest; + bool inversed_iv + = !vect_is_loop_exit_latch_pred (LOOP_VINFO_IV_EXIT (loop_vinfo), + LOOP_VINFO_LOOP (loop_vinfo)); - basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest; - - /* Make sure there exists a single-predecessor exit bb: */ - gcc_assert (single_pred_p (exit_bb)); - gcc_assert (single_succ_edge (exit_bb) == update_e); + edge loop_e = LOOP_VINFO_IV_EXIT (loop_vinfo); + gcond *cond = get_loop_exit_condition (loop_e); + basic_block exit_bb = loop_e->dest; + basic_block iv_block = NULL; + gimple_stmt_iterator last_gsi = gsi_last_bb (exit_bb); for (gsi = gsi_start_phis (loop->header), gsi1 = gsi_start_phis (update_bb); !gsi_end_p (gsi) && !gsi_end_p (gsi1); @@ -2241,7 +2248,6 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree step_expr, off; tree type; tree var, ni, ni_name; - gimple_stmt_iterator last_gsi; gphi *phi = gsi.phi (); gphi *phi1 = gsi1.phi (); @@ -2273,11 +2279,52 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, enum vect_induction_op_type induction_type = STMT_VINFO_LOOP_PHI_EVOLUTION_TYPE (phi_info); - if (induction_type == vect_step_op_add) + tree iv_var = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop)); + /* create_iv always places it on the LHS. Alternatively we can set a + property during create_iv to identify it. */ + bool ivtemp = gimple_cond_lhs (cond) == iv_var; + if ((!main_exit_p || inversed_iv) && ivtemp) + { + step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (phi_info); + type = TREE_TYPE (gimple_phi_result (phi)); + ni = build_int_cst (type, vf); + } + else if (!main_exit_p && inversed_iv) + continue; + else if (induction_type == vect_step_op_add) { + tree stype = TREE_TYPE (step_expr); - off = fold_build2 (MULT_EXPR, stype, - fold_convert (stype, niters), step_expr); + + /* Early exits always use last iter value not niters. */ + if (!main_exit_p || (main_exit_p && inversed_iv)) + { + /* Live statements in the non-main exit shouldn't be adjusted. We + normally didn't have this problem with a single exit as live + values would be in the exit block. However when dealing with + multiple exits all exits are redirected to the merge block + and we restart the iteration. */ + if (STMT_VINFO_LIVE_P (phi_info)) + continue; + + /* For early break the final loop IV is: + init + (final - init) * vf which takes into account peeling + values and non-single steps. The main exit can use niters + since if you exit from the main exit you've done all vector + iterations. For an early exit we don't know when we exit so we + must re-calculate this on the exit. */ + tree start_expr = gimple_phi_result (phi); + off = fold_build2 (MINUS_EXPR, stype, + fold_convert (stype, start_expr), + fold_convert (stype, init_expr)); + /* Now adjust for VF to get the final iteration value. */ + off = fold_build2 (MULT_EXPR, stype, off, + build_int_cst (stype, vf)); + } + else + off = fold_build2 (MULT_EXPR, stype, + fold_convert (stype, niters), step_expr); + if (POINTER_TYPE_P (type)) ni = fold_build_pointer_plus (init_expr, off); else @@ -2289,6 +2336,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, /* Don't bother call vect_peel_nonlinear_iv_init. */ else if (induction_type == vect_step_op_neg) ni = init_expr; + else if (!main_exit_p) + continue; else ni = vect_peel_nonlinear_iv_init (&stmts, init_expr, niters, step_expr, @@ -2296,9 +2345,20 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, var = create_tmp_var (type, "tmp"); - last_gsi = gsi_last_bb (exit_bb); gimple_seq new_stmts = NULL; ni_name = force_gimple_operand (ni, &new_stmts, false, var); + + /* For non-main exit create an intermediat edge to get any updated iv + calculations. */ + if (!main_exit_p + && !iv_block + && (!gimple_seq_empty_p (stmts) || !gimple_seq_empty_p (new_stmts))) + { + iv_block = split_edge (update_e); + update_e = single_succ_edge (update_e->dest); + last_gsi = gsi_last_bb (iv_block); + } + /* Exit_bb shouldn't be empty. */ if (!gsi_end_p (last_gsi)) { @@ -2836,12 +2896,18 @@ find_guard_arg (class loop *loop ATTRIBUTE_UNUSED, const_edge loop_e, tree var = PHI_ARG_DEF (phi, loop_e->dest_idx); if (TREE_CODE (var) != SSA_NAME) continue; - tree def = get_current_def (var); - if (!def) - continue; - if (operand_equal_p (def, - PHI_ARG_DEF (lcssa_phi, lcssa_edge), 0)) - return PHI_RESULT (phi); + + /* The value could be carried all the way from the loop version block + in which case we wouldn't have kept the value if it's not used in + the loop. In such cases get_current_def returns null as the value + is already current. */ + tree orig_var = get_current_def (var); + if (!orig_var) + orig_var = var; + + if (operand_equal_p (orig_var, + PHI_ARG_DEF (lcssa_phi, lcssa_edge), 0)) + return PHI_RESULT (phi); } } return NULL_TREE; @@ -3528,8 +3594,21 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, niters_vector_mult_vf steps. */ gcc_checking_assert (vect_can_advance_ivs_p (loop_vinfo)); update_e = skip_vector ? e : loop_preheader_edge (epilog); - vect_update_ivs_after_vectorizer (loop_vinfo, niters_vector_mult_vf, - update_e); + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + update_e = single_succ_edge (e->dest); + bool inversed_iv + = !vect_is_loop_exit_latch_pred (LOOP_VINFO_IV_EXIT (loop_vinfo), + LOOP_VINFO_LOOP (loop_vinfo)); + + for (auto exit : get_loop_exit_edges (loop)) + { + bool main_exit_p = vect_is_loop_exit_latch_pred (exit, loop); + edge exit_e = main_exit_p ? update_e : exit; + vect_update_ivs_after_vectorizer (loop_vinfo, vf, + niters_vector_mult_vf, exit_e, + main_exit_p); + + } if (skip_epilog) { --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -1187,7 +1187,7 @@ vect_set_loop_condition_partial_vectors_avx512 (class loop *loop, loop handles exactly VF scalars per iteration. */ static gcond * -vect_set_loop_condition_normal (loop_vec_info loop_vinfo, edge exit_edge, +vect_set_loop_condition_normal (loop_vec_info /* loop_vinfo */, edge exit_edge, class loop *loop, tree niters, tree step, tree final_iv, bool niters_maybe_zero, gimple_stmt_iterator loop_cond_gsi) @@ -1452,7 +1452,7 @@ slpeel_duplicate_current_defs_from_edges (edge from, edge to) When this happens we need to flip the understanding of main and other exits by peeling and IV updates. */ -bool +bool inline vect_is_loop_exit_latch_pred (edge loop_exit, class loop *loop) { return single_pred (loop->latch) == loop_exit->src; @@ -2193,6 +2193,7 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) Input: - LOOP - a loop that is going to be vectorized. The last few iterations of LOOP were peeled. + - VF - The chosen vectorization factor for LOOP. - NITERS - the number of iterations that LOOP executes (before it is vectorized). i.e, the number of times the ivs should be bumped. - UPDATE_E - a successor edge of LOOP->exit that is on the (only) path @@ -2203,6 +2204,9 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) The phi args associated with the edge UPDATE_E in the bb UPDATE_E->dest are updated accordingly. + - MAIN_EXIT_P - Indicates whether UPDATE_E is twhat the vectorizer + considers the main loop exit. + Assumption 1: Like the rest of the vectorizer, this function assumes a single loop exit that has a single predecessor. @@ -2220,18 +2224,21 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo) */ static void -vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, - tree niters, edge update_e) +vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, poly_uint64 vf, + tree niters, edge update_e, bool main_exit_p) { gphi_iterator gsi, gsi1; class loop *loop = LOOP_VINFO_LOOP (loop_vinfo); basic_block update_bb = update_e->dest; + bool inversed_iv + = !vect_is_loop_exit_latch_pred (LOOP_VINFO_IV_EXIT (loop_vinfo), + LOOP_VINFO_LOOP (loop_vinfo)); - basic_block exit_bb = LOOP_VINFO_IV_EXIT (loop_vinfo)->dest; - - /* Make sure there exists a single-predecessor exit bb: */ - gcc_assert (single_pred_p (exit_bb)); - gcc_assert (single_succ_edge (exit_bb) == update_e); + edge loop_e = LOOP_VINFO_IV_EXIT (loop_vinfo); + gcond *cond = get_loop_exit_condition (loop_e); + basic_block exit_bb = loop_e->dest; + basic_block iv_block = NULL; + gimple_stmt_iterator last_gsi = gsi_last_bb (exit_bb); for (gsi = gsi_start_phis (loop->header), gsi1 = gsi_start_phis (update_bb); !gsi_end_p (gsi) && !gsi_end_p (gsi1); @@ -2241,7 +2248,6 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, tree step_expr, off; tree type; tree var, ni, ni_name; - gimple_stmt_iterator last_gsi; gphi *phi = gsi.phi (); gphi *phi1 = gsi1.phi (); @@ -2273,11 +2279,52 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, enum vect_induction_op_type induction_type = STMT_VINFO_LOOP_PHI_EVOLUTION_TYPE (phi_info); - if (induction_type == vect_step_op_add) + tree iv_var = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop)); + /* create_iv always places it on the LHS. Alternatively we can set a + property during create_iv to identify it. */ + bool ivtemp = gimple_cond_lhs (cond) == iv_var; + if ((!main_exit_p || inversed_iv) && ivtemp) + { + step_expr = STMT_VINFO_LOOP_PHI_EVOLUTION_PART (phi_info); + type = TREE_TYPE (gimple_phi_result (phi)); + ni = build_int_cst (type, vf); + } + else if (!main_exit_p && inversed_iv) + continue; + else if (induction_type == vect_step_op_add) { + tree stype = TREE_TYPE (step_expr); - off = fold_build2 (MULT_EXPR, stype, - fold_convert (stype, niters), step_expr); + + /* Early exits always use last iter value not niters. */ + if (!main_exit_p || (main_exit_p && inversed_iv)) + { + /* Live statements in the non-main exit shouldn't be adjusted. We + normally didn't have this problem with a single exit as live + values would be in the exit block. However when dealing with + multiple exits all exits are redirected to the merge block + and we restart the iteration. */ + if (STMT_VINFO_LIVE_P (phi_info)) + continue; + + /* For early break the final loop IV is: + init + (final - init) * vf which takes into account peeling + values and non-single steps. The main exit can use niters + since if you exit from the main exit you've done all vector + iterations. For an early exit we don't know when we exit so we + must re-calculate this on the exit. */ + tree start_expr = gimple_phi_result (phi); + off = fold_build2 (MINUS_EXPR, stype, + fold_convert (stype, start_expr), + fold_convert (stype, init_expr)); + /* Now adjust for VF to get the final iteration value. */ + off = fold_build2 (MULT_EXPR, stype, off, + build_int_cst (stype, vf)); + } + else + off = fold_build2 (MULT_EXPR, stype, + fold_convert (stype, niters), step_expr); + if (POINTER_TYPE_P (type)) ni = fold_build_pointer_plus (init_expr, off); else @@ -2289,6 +2336,8 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, /* Don't bother call vect_peel_nonlinear_iv_init. */ else if (induction_type == vect_step_op_neg) ni = init_expr; + else if (!main_exit_p) + continue; else ni = vect_peel_nonlinear_iv_init (&stmts, init_expr, niters, step_expr, @@ -2296,9 +2345,20 @@ vect_update_ivs_after_vectorizer (loop_vec_info loop_vinfo, var = create_tmp_var (type, "tmp"); - last_gsi = gsi_last_bb (exit_bb); gimple_seq new_stmts = NULL; ni_name = force_gimple_operand (ni, &new_stmts, false, var); + + /* For non-main exit create an intermediat edge to get any updated iv + calculations. */ + if (!main_exit_p + && !iv_block + && (!gimple_seq_empty_p (stmts) || !gimple_seq_empty_p (new_stmts))) + { + iv_block = split_edge (update_e); + update_e = single_succ_edge (update_e->dest); + last_gsi = gsi_last_bb (iv_block); + } + /* Exit_bb shouldn't be empty. */ if (!gsi_end_p (last_gsi)) { @@ -2836,12 +2896,18 @@ find_guard_arg (class loop *loop ATTRIBUTE_UNUSED, const_edge loop_e, tree var = PHI_ARG_DEF (phi, loop_e->dest_idx); if (TREE_CODE (var) != SSA_NAME) continue; - tree def = get_current_def (var); - if (!def) - continue; - if (operand_equal_p (def, - PHI_ARG_DEF (lcssa_phi, lcssa_edge), 0)) - return PHI_RESULT (phi); + + /* The value could be carried all the way from the loop version block + in which case we wouldn't have kept the value if it's not used in + the loop. In such cases get_current_def returns null as the value + is already current. */ + tree orig_var = get_current_def (var); + if (!orig_var) + orig_var = var; + + if (operand_equal_p (orig_var, + PHI_ARG_DEF (lcssa_phi, lcssa_edge), 0)) + return PHI_RESULT (phi); } } return NULL_TREE; @@ -3528,8 +3594,21 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1, niters_vector_mult_vf steps. */ gcc_checking_assert (vect_can_advance_ivs_p (loop_vinfo)); update_e = skip_vector ? e : loop_preheader_edge (epilog); - vect_update_ivs_after_vectorizer (loop_vinfo, niters_vector_mult_vf, - update_e); + if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)) + update_e = single_succ_edge (e->dest); + bool inversed_iv + = !vect_is_loop_exit_latch_pred (LOOP_VINFO_IV_EXIT (loop_vinfo), + LOOP_VINFO_LOOP (loop_vinfo)); + + for (auto exit : get_loop_exit_edges (loop)) + { + bool main_exit_p = vect_is_loop_exit_latch_pred (exit, loop); + edge exit_e = main_exit_p ? update_e : exit; + vect_update_ivs_after_vectorizer (loop_vinfo, vf, + niters_vector_mult_vf, exit_e, + main_exit_p); + + } if (skip_epilog) {