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.129.124]) by sourceware.org (Postfix) with ESMTPS id 9E6A03858C50 for ; Tue, 4 Oct 2022 22:21:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9E6A03858C50 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=1664922080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q9T0l4ZyFfScSwuJs5fUo9dTEdS8C1Km6yjLcWKU5AQ=; b=DLHDLZjPiZ/9fzjQRyGpiL99iQeWIjolBblIzAWRd3GEH1UuUhpwl5LoC7+tr4mpJEkIyS /VZlWyR9PBy+dxdFBsw8WgunPrZiKlfHDZTFVY05LRlsDmNBs09ZFEh9nMv0VhkP0oq/Tz kEIHnmNU+ILi0lv2pIysdsLfTJJtYpc= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-515-bENZmxMVPZ-cap9kAzldYg-1; Tue, 04 Oct 2022 18:21:14 -0400 X-MC-Unique: bENZmxMVPZ-cap9kAzldYg-1 Received: by mail-qv1-f71.google.com with SMTP id ly5-20020a0562145c0500b004af8e9c4d94so9598169qvb.0 for ; Tue, 04 Oct 2022 15:21:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=q9T0l4ZyFfScSwuJs5fUo9dTEdS8C1Km6yjLcWKU5AQ=; b=aFYPTURZgajZT4YAtQTpQCUrk52i+vkFN/BD2Y434WxJ+eeuVyMQV0DhLVZUqolJNz 99TT+2fUfhJysM3wn3SzXyiopsCseKaWdwRArFE9k+RKddN/2B8BAXh3KT5wkHj43vzc HWT/K8g6uvMyB3JkBA69kcgPCuMD+MfR8xYV+Qf7FQiMGTtJlw+bOGEx9ireSoXaPCuU EcNUPUL63NfnrYXS5XXLhPGFhQGCRTuNFWqOR/R8+j4xsR48Fr+BVACsWw8haMoBHE5w qm1WlmAGFRzbyv8YRK/4/CyAPxOnNcZ+cyOhRn8NYw7rLwHiXOyWRPtrribZ1swSTMBE AA5g== X-Gm-Message-State: ACrzQf3/V7LJHgb89NpBaO8elv/y/tGwMBjgwTTxar6Y+51yTRw3YHL+ kAl3pbGN00A5tIEG7yG+BVJf29cI/vDkVlexgO9e1PdNqC1eXKulwcGTjaKldOb47t2dyIlAgA9 N+4p1ZEwgb+Na16St4Q== X-Received: by 2002:ae9:e816:0:b0:6cd:d849:859c with SMTP id a22-20020ae9e816000000b006cdd849859cmr18532663qkg.287.1664922074298; Tue, 04 Oct 2022 15:21:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kOSJEmyoEtiNNNlbwBifSIS0vCYN028Yw9MjpfteHCUs2hH3fxsNF+NZpuZNwHEo0wzkgDw== X-Received: by 2002:ae9:e816:0:b0:6cd:d849:859c with SMTP id a22-20020ae9e816000000b006cdd849859cmr18532653qkg.287.1664922073985; Tue, 04 Oct 2022 15:21:13 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id br31-20020a05620a461f00b006b9bf03d9c6sm15620578qkb.104.2022.10.04.15.21.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Oct 2022 15:21:13 -0700 (PDT) Message-ID: Date: Tue, 4 Oct 2022 18:21:12 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1 Subject: Re: [PATCH] Set discriminators for call stmts on the same line within the same basic block To: Eugene Rozenfeld , "gcc-patches@gcc.gnu.org" References: From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,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 List-Id: On 10/3/22 02:08, Eugene Rozenfeld wrote: > This change is based on commit 1e6c4a7a8fb8e20545bb9f9032d3854f3f794c18 > by Dehao Chen in vendors/google/heads/gcc-4_8. > > Tested on x86_64-pc-linux-gnu. Brief rationale for the change? > gcc/ChangeLog: > * tree-cfg.cc (assign_discriminators): Set discriminators for call stmts > on the same line within the same basic block. > --- > gcc/tree-cfg.cc | 31 +++++++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc > index ade66c54499..8e2a3a5f6c6 100644 > --- a/gcc/tree-cfg.cc > +++ b/gcc/tree-cfg.cc > @@ -1203,8 +1203,39 @@ assign_discriminators (void) > { > edge e; > edge_iterator ei; > + gimple_stmt_iterator gsi; > gimple *last = last_stmt (bb); > location_t locus = last ? gimple_location (last) : UNKNOWN_LOCATION; > + location_t curr_locus = UNKNOWN_LOCATION; > + int curr_discr = 0; > + > + /* Traverse the basic block, if two function calls within a basic block > + are mapped to the same line, assign a new discriminator because a call > + stmt could be a split point of a basic block. */ > + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) > + { > + gimple *stmt = gsi_stmt (gsi); > + expanded_location curr_locus_e; > + if (curr_locus == UNKNOWN_LOCATION) > + { > + curr_locus = gimple_location (stmt); > + curr_locus_e = expand_location (curr_locus); > + } > + else if (!same_line_p (curr_locus, &curr_locus_e, gimple_location (stmt))) > + { > + curr_locus = gimple_location (stmt); > + curr_locus_e = expand_location (curr_locus); > + curr_discr = 0; > + } > + else if (curr_discr != 0) > + { > + gimple_set_location (stmt, location_with_discriminator ( > + gimple_location (stmt), curr_discr)); This indentation is wonky, with an open paren at the end of the line; I'd suggest reformatting to > location_t dloc = (location_with_discriminator > (gimple_location (stmt), curr_discr));> gimple_set_location (stmt, dloc); Jason