From patchwork Wed Jun 23 14:27:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1496163 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=I3WL2BDP; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G95Hk2vKPz9sWc for ; Thu, 24 Jun 2021 00:29:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EA4A139874C0 for ; Wed, 23 Jun 2021 14:29:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA4A139874C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1624458560; bh=r8L8JSPNB9+NGFZpnOKXZm6UbqcZJcpPKCKP7/NzdwQ=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=I3WL2BDPfiwXQL/wnAEgCDq+YSTDN2taZEbVrItSLacRJ2q4FvYjXkvqqmKuIdYRh OKlyaRcoNkyRMbfOw1x8XpRKExTP5xyUoZOD0kTZX0EJXEdubrns1OClOPqK48UceF m+JFBjo2px2UYIi0qJNaV2xv38yLTYxVXXqLF6Jg= 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.133.124]) by sourceware.org (Postfix) with ESMTP id DADB8383F423 for ; Wed, 23 Jun 2021 14:27:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DADB8383F423 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-MGJPdFLJMxi7cmOVZw4oSg-1; Wed, 23 Jun 2021 10:27:21 -0400 X-MC-Unique: MGJPdFLJMxi7cmOVZw4oSg-1 Received: by mail-qk1-f198.google.com with SMTP id 14-20020a37060e0000b02903aad32851d2so2726736qkg.1 for ; Wed, 23 Jun 2021 07:27:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language; bh=r8L8JSPNB9+NGFZpnOKXZm6UbqcZJcpPKCKP7/NzdwQ=; b=nsF8prJtDYlfsZh3Cg0SFUgW2NyuFjMgtHmnjaSM8mmWPyRvRf2Ueg3Ws5iPvGW7UM 1lFjJQX3PAQLBNimPD8X0Wtqx6UYzD+/n5KmhiGFeANMG3INjL62QeGAm4PTy57SWaSL bq/acgeqQx6uT55fwUe5MbbsTYUKgNIo5VsXysHhWZMkKKGXzfqJ6qHUQQtapw+D0+yq jsi5rjlhyyBlOuy5Y6N+gBhfQGa37VjLOHnpknZSIvHcDoYgA96q7JxCjhbpOsSxb7bZ r+O8IkR/gWwt3WgUm2GOZSIDUN1d6k22BUPfXlfSYJ/ggCKqJuqwgu6lAz+Fk23bAJ/6 y6BA== X-Gm-Message-State: AOAM530Zvnf8aYdxXkW1UGBEMIixGZCDucRUrM9TJE/w9LDMtjy3dqS1 r/kjrlyQlGjRvkbrvztIGxVee3DitEorrUMlgsZLl6xtSctBSxYy+WBfAQJ+OhaiGq1Vzo+vs/g iBknQL06fVSW5QZT3pw== X-Received: by 2002:a05:622a:1a83:: with SMTP id s3mr145012qtc.347.1624458440796; Wed, 23 Jun 2021 07:27:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhnNclI/ax/qIgzj/JVODnmv7GhZM9xDdzSuBFAQCD2uTdHnyKJx9FaRpQsl9F3cl8wAaH/A== X-Received: by 2002:a05:622a:1a83:: with SMTP id s3mr145002qtc.347.1624458440662; Wed, 23 Jun 2021 07:27:20 -0700 (PDT) Received: from ?IPv6:2607:fea8:a241:4600::58f9? ([2607:fea8:a241:4600::58f9]) by smtp.gmail.com with ESMTPSA id z12sm67247qtq.25.2021.06.23.07.27.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 07:27:20 -0700 (PDT) Subject: [COMMITTED 1/2] Adjust on_entry cache to indicate if the value was set properly. To: gcc-patches Message-ID: Date: Wed, 23 Jun 2021 10:27:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-CA X-Spam-Status: No, score=-12.0 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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" The introduction of the sparse bitmap on-entry cache for large BB functions also introduced the concept that the value we ask to be written to the cache may not be properly represented.  It is limited to 15 unique ranges for any given ssa-name, then  it reverts to varying for any additional values to be safe. This patch adds a boolean return value to the cache set routines, allowing us to check if the value was properly written. Other than that, no functional change. Bootstrap on x86_64-pc-linux-gnu with no regressions.  pushed. Andrew From ca4d381662c37733b2a1d49d6c8f5fcfc1348f3d Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 22 Jun 2021 17:21:32 -0400 Subject: [PATCH 2/4] Adjust on_entry cache to indicate if the value was set properly. * gimple-range-cache.cc (class ssa_block_ranges): Adjust prototype. (sbr_vector::set_bb_range): Return true. (class sbr_sparse_bitmap): Adjust. (sbr_sparse_bitmap::set_bb_range): Return value. (block_range_cache::set_bb_range): Return value. (ranger_cache::propagate_cache): Use return value to print msg. * gimple-range-cache.h (class block_range_cache): Adjust. --- gcc/gimple-range-cache.cc | 44 ++++++++++++++++++++++----------------- gcc/gimple-range-cache.h | 2 +- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 4347485cf98..bdecd212691 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -132,7 +132,7 @@ non_null_ref::process_name (tree name) class ssa_block_ranges { public: - virtual void set_bb_range (const basic_block bb, const irange &r) = 0; + virtual bool set_bb_range (const basic_block bb, const irange &r) = 0; virtual bool get_bb_range (irange &r, const basic_block bb) = 0; virtual bool bb_range_p (const basic_block bb) = 0; @@ -165,7 +165,7 @@ class sbr_vector : public ssa_block_ranges public: sbr_vector (tree t, irange_allocator *allocator); - virtual void set_bb_range (const basic_block bb, const irange &r) OVERRIDE; + virtual bool set_bb_range (const basic_block bb, const irange &r) OVERRIDE; virtual bool get_bb_range (irange &r, const basic_block bb) OVERRIDE; virtual bool bb_range_p (const basic_block bb) OVERRIDE; protected: @@ -196,7 +196,7 @@ sbr_vector::sbr_vector (tree t, irange_allocator *allocator) // Set the range for block BB to be R. -void +bool sbr_vector::set_bb_range (const basic_block bb, const irange &r) { irange *m; @@ -208,6 +208,7 @@ sbr_vector::set_bb_range (const basic_block bb, const irange &r) else m = m_irange_allocator->allocate (r); m_tab[bb->index] = m; + return true; } // Return the range associated with block BB in R. Return false if @@ -252,7 +253,7 @@ class sbr_sparse_bitmap : public ssa_block_ranges { public: sbr_sparse_bitmap (tree t, irange_allocator *allocator, bitmap_obstack *bm); - virtual void set_bb_range (const basic_block bb, const irange &r) OVERRIDE; + virtual bool set_bb_range (const basic_block bb, const irange &r) OVERRIDE; virtual bool get_bb_range (irange &r, const basic_block bb) OVERRIDE; virtual bool bb_range_p (const basic_block bb) OVERRIDE; private: @@ -312,13 +313,13 @@ sbr_sparse_bitmap::bitmap_get_quad (const_bitmap head, int quad) // Set the range on entry to basic block BB to R. -void +bool sbr_sparse_bitmap::set_bb_range (const basic_block bb, const irange &r) { if (r.undefined_p ()) { bitmap_set_quad (bitvec, bb->index, SBR_UNDEF); - return; + return true; } // Loop thru the values to see if R is already present. @@ -328,11 +329,11 @@ sbr_sparse_bitmap::set_bb_range (const basic_block bb, const irange &r) if (!m_range[x]) m_range[x] = m_irange_allocator->allocate (r); bitmap_set_quad (bitvec, bb->index, x + 1); - return; + return true; } // All values are taken, default to VARYING. bitmap_set_quad (bitvec, bb->index, SBR_VARYING); - return; + return false; } // Return the range associated with block BB in R. Return false if @@ -387,7 +388,7 @@ block_range_cache::~block_range_cache () // Set the range for NAME on entry to block BB to R. // If it has not been accessed yet, allocate it first. -void +bool block_range_cache::set_bb_range (tree name, const basic_block bb, const irange &r) { @@ -413,7 +414,7 @@ block_range_cache::set_bb_range (tree name, const basic_block bb, m_irange_allocator); } } - m_ssa_ranges[v]->set_bb_range (bb, r); + return m_ssa_ranges[v]->set_bb_range (bb, r); } @@ -1061,13 +1062,18 @@ ranger_cache::propagate_cache (tree name) // If the range on entry has changed, update it. if (new_range != current_range) { + bool ok_p = m_on_entry.set_bb_range (name, bb, new_range); if (DEBUG_RANGE_CACHE) { - fprintf (dump_file, " Updating range to "); - new_range.dump (dump_file); + if (!ok_p) + fprintf (dump_file, " Cache failure to store value."); + else + { + fprintf (dump_file, " Updating range to "); + new_range.dump (dump_file); + } fprintf (dump_file, "\n Updating blocks :"); } - m_on_entry.set_bb_range (name, bb, new_range); // Mark each successor that has a range to re-check its range FOR_EACH_EDGE (e, ei, bb->succs) if (m_on_entry.bb_range_p (name, e->dest)) @@ -1080,12 +1086,12 @@ ranger_cache::propagate_cache (tree name) fprintf (dump_file, "\n"); } } - if (DEBUG_RANGE_CACHE) - { - fprintf (dump_file, "DONE visiting blocks for "); - print_generic_expr (dump_file, name, TDF_SLIM); - fprintf (dump_file, "\n"); - } + if (DEBUG_RANGE_CACHE) + { + fprintf (dump_file, "DONE visiting blocks for "); + print_generic_expr (dump_file, name, TDF_SLIM); + fprintf (dump_file, "\n"); + } } // Check to see if an update to the value for NAME in BB has any effect diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index 04150ea54a8..1d2e1b99200 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -50,7 +50,7 @@ public: block_range_cache (); ~block_range_cache (); - void set_bb_range (tree name, const basic_block bb, const irange &r); + bool set_bb_range (tree name, const basic_block bb, const irange &r); bool get_bb_range (irange &r, tree name, const basic_block bb); bool bb_range_p (tree name, const basic_block bb); -- 2.17.2 From patchwork Wed Jun 23 14:27:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew MacLeod X-Patchwork-Id: 1496165 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=QKcZNM2u; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G95Jt3M9Pz9sWc for ; Thu, 24 Jun 2021 00:30:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0ED8A383D01C for ; Wed, 23 Jun 2021 14:30:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0ED8A383D01C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1624458620; bh=9+et4HarMeg/1Cy1oyI+c6Tp1i5HvAQQCq0+wE7FHTA=; h=Subject:To:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QKcZNM2uGHe1Ua5LeXOjQjKX1/0DAeJ+/Ve5g6oGO7ualJ/lW3/pKa4ePFsDQuUo6 gBZxikZvO8O5pIsL8Uw/GYV0le53jGP4Nnf98/eIzPgrPnT+pmKAmGuV2ydQy5l0dN q2fKBlpWBC3uHz0jutSnoHEc5gSdCRpWFDsaE0Z8= 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.133.124]) by sourceware.org (Postfix) with ESMTP id 03C293985C11 for ; Wed, 23 Jun 2021 14:27:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03C293985C11 Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-PV5ogC4uOxOt31dxsbFtnw-1; Wed, 23 Jun 2021 10:27:31 -0400 X-MC-Unique: PV5ogC4uOxOt31dxsbFtnw-1 Received: by mail-qk1-f200.google.com with SMTP id d194-20020a3768cb0000b02903ad9d001bb6so2700696qkc.7 for ; Wed, 23 Jun 2021 07:27:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-language; bh=9+et4HarMeg/1Cy1oyI+c6Tp1i5HvAQQCq0+wE7FHTA=; b=dQKhr3no6/vDFChFyaLNxfc9Qj5AswpobNDBukYwsyGnBmhfxPFAllXR37LUKsjQbB qHKhD+xgp2rgeWJOhDsKWqHE1BUWL2Q0Tr5dMacVHyZ0qJmG400AOK6ibaAyxKCHzPy1 AsHuRApkXDqAHoLnYnmgT/XCM2h5cuIDqu2NmvzlMFAxKebIlWTZaG6UmLP3wGFCKiWH Tyh5Mb5uAOoCKyv7cTlBNt6bZJ0BWhfY1z/aSb9pVgvaTgeWK+qc+bZTAFPUx5RCBJxI a8Ri6w1tZBECtAkcofzzLXYKseD6ztd+BvOHpLCdzWJWvVzdCKapGtOndzI1iBteExpu aB7w== X-Gm-Message-State: AOAM530/gndBmsE9tuf/qtbs6ecoeHrSHL8XCZsEd5Pq/3W/hAhwy170 tV8jCJU+iQpYnLfY5iOI9G6mhLbL7nkkq+RTXSeA8+B3NYf4HRpvTzogwynkQHT+MzciNc16Lfd pvTnDhtcNlff28SiS3A== X-Received: by 2002:ac8:40ca:: with SMTP id f10mr146539qtm.319.1624458451063; Wed, 23 Jun 2021 07:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOQil7m2DUjiC91rZgU/LJFP+ZG+6M3dQkkdhx5IeULT76EdGrEbWIS61pcj8RgWy8BkEZag== X-Received: by 2002:ac8:40ca:: with SMTP id f10mr146533qtm.319.1624458450899; Wed, 23 Jun 2021 07:27:30 -0700 (PDT) Received: from ?IPv6:2607:fea8:a241:4600::58f9? ([2607:fea8:a241:4600::58f9]) by smtp.gmail.com with ESMTPSA id i16sm8492580qki.121.2021.06.23.07.27.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Jun 2021 07:27:30 -0700 (PDT) Subject: [COMMITTED 2/2] tree-optimization/101148 - Do not continue propagating values which cannot be set properly. To: gcc-patches Message-ID: <84b8a37c-c633-385d-bbfa-00da1cf99064@redhat.com> Date: Wed, 23 Jun 2021 10:27:29 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-CA X-Spam-Status: No, score=-12.1 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_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Andrew MacLeod via Gcc-patches From: Andrew MacLeod Reply-To: Andrew MacLeod Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" As described in PR 101014, this patch should fix both PRs. The cache propagation engine works by combining incoming ranges to a block and if that is different than that current on-entry range, proceeds to push this new value on outgoing edges. What was happening here is this new value that was calculated was beyond the 15 allowed by the sparse bitmap implem,entation. When it was stored, it was storing a different value (VARYING).  This block was in a cycle feeding back to itself.  When it calculated the on-entry value again and compared, it thought it needed to update again.  Which of course failed again... and the endless loop of trying to propagate was born. This patch checks that the value being stored to the cache was successful.  If it was not, then this block is flagged to deny future attempts to propagate from this block (during this update cycle). Bootstrap on x86_64-pc-linux-gnu with no regressions.  pushed. Andrew From a03e944e92ee51ae583382079d4739b64bd93b35 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Tue, 22 Jun 2021 17:46:05 -0400 Subject: [PATCH 3/4] Do not continue propagating values which cannot be set properly. If the on-entry cache cannot properly represent a range, do not continue trying to propagate it. PR tree-optimization/101148 PR tree-optimization/101014 * gimple-range-cache.cc (ranger_cache::ranger_cache): Adjust. (ranger_cache::~ranger_cache): Adjust. (ranger_cache::block_range): Check if propagation disallowed. (ranger_cache::propagate_cache): Disallow propagation if new value can't be stored properly. * gimple-range-cache.h (ranger_cache::m_propfail): New member. --- gcc/gimple-range-cache.cc | 11 ++++++++++- gcc/gimple-range-cache.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index bdecd212691..a377261c5c7 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -731,10 +731,12 @@ ranger_cache::ranger_cache () if (bb) m_gori.exports (bb); } + m_propfail = BITMAP_ALLOC (NULL); } ranger_cache::~ranger_cache () { + BITMAP_FREE (m_propfail); if (m_oracle) delete m_oracle; delete m_temporal; @@ -990,7 +992,9 @@ ranger_cache::block_range (irange &r, basic_block bb, tree name, bool calc) void ranger_cache::add_to_update (basic_block bb) { - if (!m_update_list.contains (bb)) + // If propagation has failed for BB, or its already in the list, don't + // add it again. + if (!bitmap_bit_p (m_propfail, bb->index) && !m_update_list.contains (bb)) m_update_list.quick_push (bb); } @@ -1007,6 +1011,7 @@ ranger_cache::propagate_cache (tree name) int_range_max current_range; int_range_max e_range; + gcc_checking_assert (bitmap_empty_p (m_propfail)); // Process each block by seeing if its calculated range on entry is // the same as its cached value. If there is a difference, update // the cache to reflect the new value, and check to see if any @@ -1063,6 +1068,9 @@ ranger_cache::propagate_cache (tree name) if (new_range != current_range) { bool ok_p = m_on_entry.set_bb_range (name, bb, new_range); + // If the cache couldn't set the value, mark it as failed. + if (!ok_p) + bitmap_set_bit (m_propfail, bb->index); if (DEBUG_RANGE_CACHE) { if (!ok_p) @@ -1092,6 +1100,7 @@ ranger_cache::propagate_cache (tree name) print_generic_expr (dump_file, name, TDF_SLIM); fprintf (dump_file, "\n"); } + bitmap_clear (m_propfail); } // Check to see if an update to the value for NAME in BB has any effect diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index 1d2e1b99200..ecf63dc01b3 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -121,6 +121,7 @@ private: void propagate_updated_value (tree name, basic_block bb); + bitmap m_propfail; vec m_workback; vec m_update_list; }; -- 2.17.2