From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F230A3858D28 for ; Tue, 3 Oct 2023 17:03:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F230A3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696352580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OQpVPwaVZnyYmNowToUnqQTxRYakwkkipe7pB0DPyS0=; b=b8YVFz2pPhGkdHjth+aLaqZQYz83XCVR0fvtT4COVyTWlTtbW9hGtX6dMauBUbXwEVehQr lKtSflWOrCcpsebYVOpgRI4jJZL4Xwy2C6qIo3ZvR0qoGztiL3jJxJUdTaepjzecD1ZabX zfvWSK5CJA67uHBx+RboX+cKuhS6Dgo= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-118-8YWY2tfQOlOCEHbZ7eG6Xw-1; Tue, 03 Oct 2023 13:02:59 -0400 X-MC-Unique: 8YWY2tfQOlOCEHbZ7eG6Xw-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-65af7c82f0aso12581556d6.3 for ; Tue, 03 Oct 2023 10:02:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696352579; x=1696957379; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=YSw6QIrSxv5yVk+rs8Tx1BS+XQ8o3X23hQezL+znNVI=; b=hNtHZ7wKDgRc1ed3KBmLY1dNla4/UfJSHSiKTHUftmIoitSEU7kSC4lBgs3nMhXM// WX20sA6PqHEDJ+TjG1knRYibOr+Q1L3XiO1NJtA27MckDSZLQMO3SsMnSg0GXIzG5VFp t9lDww59U1HJXTtN0NUFpj1Q69hudmGTGIroA4piVEH4oeLbjS2au0He0amvOWKGjIGx 8j9szIMmJdtf57i9/VS7rOXHEWp2TiCTdITD8p23m+QpLtDLPN/6CSijZWpoupdEf/v2 afGoq/Iw0p6q+iQFVHii+jPiInkYIec6I8HBuqCq2AWgCWdg99X8vxEdO7ixX3PguLCd g66Q== X-Gm-Message-State: AOJu0YxP2jbAwou71sUXfqhzHXDxIukQ0shdXxxj4KYCEVlLtf6pRqbB K51XXIZ9W8wUYnXAm8qVDv8fPmYTiMKKOXnWmze+YYQd6LzsJWAv72v7rtFfUCm9SozQAkKv8rr h1/jf+oU= X-Received: by 2002:a0c:ecca:0:b0:65d:b9b:f318 with SMTP id o10-20020a0cecca000000b0065d0b9bf318mr14992962qvq.24.1696352578842; Tue, 03 Oct 2023 10:02:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG7DGII75WxTgAfV437H7ndzCNBBjSryQ6+E3B1BlhJsVGRn015BtbFfnRQgU6xAH6xSJgzkA== X-Received: by 2002:a0c:ecca:0:b0:65d:b9b:f318 with SMTP id o10-20020a0cecca000000b0065d0b9bf318mr14992940qvq.24.1696352578495; Tue, 03 Oct 2023 10:02:58 -0700 (PDT) Received: from t14s.localdomain (c-76-28-97-5.hsd1.ma.comcast.net. [76.28.97.5]) by smtp.gmail.com with ESMTPSA id o3-20020a0ccb03000000b0064f4ac061b0sm629867qvk.12.2023.10.03.10.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:02:57 -0700 (PDT) Message-ID: <32f0b8a98304dcce002b38c94de951b49cc5b8fe.camel@redhat.com> Subject: Re: [COMMITTED] Remove pass counting in VRP. From: David Malcolm To: Andrew MacLeod , gcc-patches Cc: jit@gcc.gnu.org Date: Tue, 03 Oct 2023 13:02:56 -0400 In-Reply-To: <248800ec-0e0e-6cae-5aaa-a9c69cd5f46a@redhat.com> References: <248800ec-0e0e-6cae-5aaa-a9c69cd5f46a@redhat.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 List-Id: On Tue, 2023-10-03 at 10:32 -0400, Andrew MacLeod wrote: > Pass counting in VRP is used to decide when to call early VRP, pass > the=20 > flag to enable warnings, and when the final pass is. >=20 > If you try to add additional passes, this becomes quite fragile. This > patch simply chooses the pass based on the data pointer passed in, > and=20 > remove the pass counter.=C2=A0=C2=A0 The first FULL VRP pass invokes the > warning=20 > code, and the flag passed in now represents the FINAL pass of VRP.=C2=A0= =20 > There is no longer a global flag which, as it turns out, wasn't > working=20 > well with the JIT compiler, but when undetected.=C2=A0 (Thanks to dmalcol= m > for helping me sort out what was going on there) >=20 >=20 > Bootstraps=C2=A0 on x86_64-pc-linux-gnu with no regressions.=C2=A0=C2=A0 = Pushed. [CCing jit mailing list] I'm worried that this patch may have "papered over" an issue with libgccjit. Specifically: [...snip...] > diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc > index d7b194f5904..05266dfe34a 100644 > --- a/gcc/tree-vrp.cc > +++ b/gcc/tree-vrp.cc > @@ -1120,36 +1120,44 @@ const pass_data pass_data_early_vrp =3D > ( TODO_cleanup_cfg | TODO_update_ssa | TODO_verify_all ), > }; > =20 > -static int vrp_pass_num =3D 0; > +static bool run_warning_pass =3D true; I see the global variable "run_warning_pass" starts out true here > class pass_vrp : public gimple_opt_pass > { > public: > pass_vrp (gcc::context *ctxt, const pass_data &data_) > - : gimple_opt_pass (data_, ctxt), data (data_), warn_array_bounds_p (= false), > - my_pass (vrp_pass_num++) > - {} > + : gimple_opt_pass (data_, ctxt), data (data_), > + warn_array_bounds_p (false), final_p (false) > + { > + // Only the frst VRP pass should run warnings. > + if (&data =3D=3D &pass_data_vrp) > + { > +=09warn_array_bounds_p =3D run_warning_pass; > +=09run_warning_pass =3D false; ...and run_warning_pass affects the member data pass_vrp::warn_array_bounds_p here, and then becomes false, but nothing seems to ever reset run_warning_pass back to true. It seems that with this patch, if libgccjit compiles more than one gcc_jit_context in the same process, the first context compilation will warn, whereas subsequent ones in that process won't. Or did I miss something? [...snip...] Thoughts? Dave