From patchwork Fri Jul 29 08:02:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 296 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6a10:b5d6:b0:2b9:3548:2db5 with SMTP id v22csp677131pxt; Fri, 29 Jul 2022 01:03:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vgPA3CozFWa9qckq/ppTmkwXiy7j6PHGVpz/aeuobfKacRYyMEgEnpOPZgJ5L6Q/4VDBUM X-Received: by 2002:a17:907:a426:b0:72e:faf6:2873 with SMTP id sg38-20020a170907a42600b0072efaf62873mr2025835ejc.74.1659081830308; Fri, 29 Jul 2022 01:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659081830; cv=none; d=google.com; s=arc-20160816; b=ga8xBq7XD/pj4NuG4LJ8D7xaNJVYTY7eNRFsBfE8lr+vi1gq+FFRDMK+/+Vg5EjjI3 fLino46uUiIlp+lAJaRZ5Jo9gLzZs5vYQJDN6vNDfjK38SO98mfw+diqWUSraODs31Nw Cb61DCpgazns6KtQodBZJElpkHK7+Zuel9w+xCP6p37yJ4HyRUKnbn/ubu8GX9q1MsUr 3MxqHzWaCVSfIMMiQUFQrjg9zV4/W+nem1A44V0hrY4H2TslY4x07zgkekZnfkS+hb3A SwVLlwIC/Nf/+X4gR8h0JnDogTy7qFqmBR3iwMhHHb2kKoIFA98nCK0jO5FZpH0Kcao6 XU2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=KkmGNxh6gRcnLyZ61d6yrKtxHgHor5gZkHUyeEir7xM=; b=SkNlA9TFGdEQXl3yzHHL1Y9Zn/rz5T5+ThDgSLQ/QnMs7GxLMbFNd+TeJewPK2ii25 xWPoIsc/qzy+GKIpxSU7tfMAdqKorGTmx7K3dMDCMocZpV4K8JAtiQRStRze/VzRCzT1 xB5Ij2NMWlVH3Mt9Et8mXppaaUca4rOtZpndzNnhegrwcEDGecyypfy9np4xF0egaCiG Bd2zPqKsj6QXnyDyCZOQLadBiPNB3+/JKGMACsZPrItInTArEMdU2cAKTAJ2tz4eVtVO vx83ne9ozxUuj6HhUfcmv0U2ChjeDFwrnPEpvY11dVDxGc2k6NSlBXGwJ1QpPb5QhIAW wkIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=fgYVLuyn; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q29-20020a056402249d00b0043c8997b44dsi2793214eda.384.2022.07.29.01.03.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 01:03:50 -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=fgYVLuyn; 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 267773857B99 for ; Fri, 29 Jul 2022 08:03:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 267773857B99 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1659081829; bh=KkmGNxh6gRcnLyZ61d6yrKtxHgHor5gZkHUyeEir7xM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=fgYVLuyn8VHus922czC3rqCEPzdFJ0LOcP2H78g11I0OwWwloEcbB32b8t6GsCwJD btvKugzAOyLUvSw4wXdITFmddjTr3SzpWNayqzTnuV5rqTKbQa0jrEQcswCQIZAOxs 6haPYk8HkEFPDxArOGLqGeaR4CsqTeyaZw4Xd6f8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1969F385840A for ; Fri, 29 Jul 2022 08:03:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1969F385840A Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-5mSDXkhxN1KKWWiPx-HJUg-1; Fri, 29 Jul 2022 04:02:59 -0400 X-MC-Unique: 5mSDXkhxN1KKWWiPx-HJUg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4725285A581; Fri, 29 Jul 2022 08:02:59 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3C9B2166B2C; Fri, 29 Jul 2022 08:02:58 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 26T82uCq234404 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 29 Jul 2022 10:02:56 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 26T82tuX234403; Fri, 29 Jul 2022 10:02:55 +0200 Date: Fri, 29 Jul 2022 10:02:54 +0200 To: gcc-patches@gcc.gnu.org Subject: [committed] openmp: Simplify fold_build_pointer_plus callers in omp-expand Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Cc: Tobias Burnus 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?1739673389317665720?= X-GMAIL-MSGID: =?utf-8?q?1739673389317665720?= Hi! Tobias mentioned in PR106449 that fold_build_pointer_plus already fold_converts the second argument to sizetype if it doesn't already have an integral type gimple compatible with sizetype. So, this patch simplifies the callers of fold_build_pointer_plus in omp-expand so that they don't do those conversions manually. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2022-07-29 Jakub Jelinek * omp-expand.cc (expand_omp_for_init_counts, expand_omp_for_init_vars, extract_omp_for_update_vars, expand_omp_for_ordered_loops, expand_omp_simd): Don't fold_convert second argument to fold_build_pointer_plus to sizetype. Jakub --- gcc/omp-expand.cc.jj 2022-06-28 13:03:30.930689700 +0200 +++ gcc/omp-expand.cc 2022-07-28 10:47:03.138939297 +0200 @@ -2267,8 +2267,7 @@ expand_omp_for_init_counts (struct omp_f else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m1)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[i].n1)); + t = unshare_expr (fd->loops[i].n1); n1 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t); } else @@ -2291,8 +2290,7 @@ expand_omp_for_init_counts (struct omp_f else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m2)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[i].n2)); + t = unshare_expr (fd->loops[i].n2); n2 = fold_build_pointer_plus (vs[i - fd->loops[i].outer], t); } else @@ -2353,8 +2351,7 @@ expand_omp_for_init_counts (struct omp_f tree step = fold_convert (itype, unshare_expr (fd->loops[i].step)); if (POINTER_TYPE_P (TREE_TYPE (vs[i]))) - t = fold_build_pointer_plus (vs[i], - fold_convert (sizetype, step)); + t = fold_build_pointer_plus (vs[i], step); else t = fold_build2 (PLUS_EXPR, itype, vs[i], step); t = force_gimple_operand_gsi (&gsi2, t, true, NULL_TREE, @@ -2794,8 +2791,7 @@ expand_omp_for_init_vars (struct omp_for else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[j].m1)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[j].n1)); + t = unshare_expr (fd->loops[j].n1); n1 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t); } else @@ -2818,8 +2814,7 @@ expand_omp_for_init_vars (struct omp_for else if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[j].m2)); - t = fold_convert (sizetype, - unshare_expr (fd->loops[j].n2)); + t = unshare_expr (fd->loops[j].n2); n2 = fold_build_pointer_plus (vs[j - fd->loops[j].outer], t); } else @@ -2895,8 +2890,7 @@ expand_omp_for_init_vars (struct omp_for tree step = fold_convert (itype, unshare_expr (fd->loops[j].step)); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (vs[j], fold_convert (sizetype, - step)); + t = fold_build_pointer_plus (vs[j], step); else t = fold_build2 (PLUS_EXPR, itype, vs[j], step); } @@ -2959,8 +2953,7 @@ expand_omp_for_init_vars (struct omp_for = fold_convert (itype, unshare_expr (fd->loops[j].step)); t = fold_build2 (MULT_EXPR, itype, t, t2); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (n1, - fold_convert (sizetype, t)); + t = fold_build_pointer_plus (n1, t); else t = fold_build2 (PLUS_EXPR, itype, n1, t); } @@ -2970,8 +2963,7 @@ expand_omp_for_init_vars (struct omp_for t = fold_build2 (MULT_EXPR, itype, t, fold_convert (itype, fd->loops[j].step)); if (POINTER_TYPE_P (vtype)) - t = fold_build_pointer_plus (fd->loops[j].n1, - fold_convert (sizetype, t)); + t = fold_build_pointer_plus (fd->loops[j].n1, t); else t = fold_build2 (PLUS_EXPR, itype, fd->loops[j].n1, t); } @@ -3035,9 +3027,8 @@ expand_omp_for_init_vars (struct omp_for if (POINTER_TYPE_P (itype)) { gcc_assert (integer_onep (fd->loops[i].m2)); - t = fold_convert (sizetype, unshare_expr (fd->loops[i].n2)); t = fold_build_pointer_plus (fd->loops[i - fd->loops[i].outer].v, - t); + unshare_expr (fd->loops[i].n2)); } else { @@ -3130,7 +3121,7 @@ extract_omp_for_update_vars (struct omp_ { if (POINTER_TYPE_P (TREE_TYPE (l->v))) t = fold_build_pointer_plus (fd->loops[i + 1 - l->outer].v, - fold_convert (sizetype, t)); + t); else { tree t2 @@ -3186,9 +3177,7 @@ extract_omp_for_update_vars (struct omp_ if (l->m1) { if (POINTER_TYPE_P (TREE_TYPE (l->v))) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - l->n1)); + t = fold_build_pointer_plus (fd->loops[i].v, l->n1); else { t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m1), l->m1, @@ -3210,9 +3199,7 @@ extract_omp_for_update_vars (struct omp_ if (l->m2) { if (POINTER_TYPE_P (TREE_TYPE (l->v))) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - l->n2)); + t = fold_build_pointer_plus (fd->loops[i].v, l->n2); else { t = fold_build2 (MULT_EXPR, TREE_TYPE (l->m2), l->m2, @@ -3640,9 +3627,7 @@ expand_omp_for_ordered_loops (struct omp { gsi = gsi_last_bb (cont_bb); if (POINTER_TYPE_P (type)) - t = fold_build_pointer_plus (fd->loops[i].v, - fold_convert (sizetype, - fd->loops[i].step)); + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else t = fold_build2 (PLUS_EXPR, type, fd->loops[i].v, fold_convert (type, fd->loops[i].step)); @@ -6669,10 +6654,7 @@ expand_omp_simd (struct omp_region *regi { i = fd->collapse - 1; if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))) - { - t = fold_convert (sizetype, fd->loops[i].step); - t = fold_build_pointer_plus (fd->loops[i].v, t); - } + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else { t = fold_convert (TREE_TYPE (fd->loops[i].v), @@ -6820,10 +6802,7 @@ expand_omp_simd (struct omp_region *regi e = EDGE_SUCC (last_bb, 1); basic_block bb = split_edge (e); if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i].v))) - { - t = fold_convert (sizetype, fd->loops[i].step); - t = fold_build_pointer_plus (fd->loops[i].v, t); - } + t = fold_build_pointer_plus (fd->loops[i].v, fd->loops[i].step); else { t = fold_convert (TREE_TYPE (fd->loops[i].v),