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 B6448385C335 for ; Wed, 24 Aug 2022 22:47:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B6448385C335 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=1661381262; 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: in-reply-to:in-reply-to:references:references; bh=2yDpOvObT+H5pN/tywPsihYEmicMizehPHG/ozp4azs=; b=iZfAEkfTKQlV/kN0JWc+MyJbnQPb9Hy2WP12BEXDaFR2Gqa9ccEWVTJNYImh1XYRGLx/8W 3w6jecjp+7FSddOYysMZhDce0FADTmQHOJANqjDWROueiIY0YGIWWDey/qAJmfxWEHQ6my pU2Ts+6+tlscX6tfa7Ei9w9SQCm7NrI= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-573-4OMWI14RM3Wnf5fzOFemmA-1; Wed, 24 Aug 2022 18:47:40 -0400 X-MC-Unique: 4OMWI14RM3Wnf5fzOFemmA-1 Received: by mail-qt1-f200.google.com with SMTP id k9-20020ac80749000000b0034302b53c6cso14067789qth.22 for ; Wed, 24 Aug 2022 15:47:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=2yDpOvObT+H5pN/tywPsihYEmicMizehPHG/ozp4azs=; b=jy3SAYlstLSAToKqIM0OXyv99f07mg5+33mwqwFFXZkvANabZpWAVXzPUCdOn3Uw8p 9VpaOXsUYP+Up4Z9SLGR7F8wO4wv85GGb74cdJrh+tdpVpAyytisP59ONeOxS+rQ2H0x AbGoNb55lE2V9mPULkmw2XIsg79IG0Oew0QzeEDC4I19GNS1p/UBvykKcrSkwuNiSoBF 8gQ84GnEDx4jenHVqGmrieBdWhI4ShHDp0VCzuzYG0a3ezUhsAew3Ee0/UqYkwCTNGQ1 /LM1XPThCGWiYPlm/icMwosfPBENvbIAcWtxM4pyzqIaBnddjqb3yLfXqV9y+eiMHb9M lHRw== X-Gm-Message-State: ACgBeo0CI8HREdQs+fOzEbM9nUQuuAchtnJxCWQI1KdZ+dEO/KJkzLOx PV0Alx/SrEZYshvc1Gp0H638GZ/jseZp+VoHxEkMFP+YGVQMBFZK9lXSuIIEyec6nIMflv9Rexa yWf5+UDxgSq8aj4qGjpTXzXSvWFgDHJw= X-Received: by 2002:a05:6214:f0e:b0:496:e627:2d26 with SMTP id gw14-20020a0562140f0e00b00496e6272d26mr1297078qvb.42.1661381260165; Wed, 24 Aug 2022 15:47:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR7JujnZqsAl7FaCtS0wrUD0OvA4xcsu7DB+/0mHClg3wkiIEcYMELAUgbkWayTzqqGKVIrXJdC0HNQh7wSf/44= X-Received: by 2002:a05:6214:f0e:b0:496:e627:2d26 with SMTP id gw14-20020a0562140f0e00b00496e6272d26mr1297059qvb.42.1661381259950; Wed, 24 Aug 2022 15:47:39 -0700 (PDT) MIME-Version: 1.0 References: <20220822181509.1032874-2-whh8b@obs.cr> <20220824061648.1119635-1-whh8b@obs.cr> <20220824061648.1119635-2-whh8b@obs.cr> In-Reply-To: From: Jonathan Wakely Date: Wed, 24 Aug 2022 23:47:29 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Optimize operator+(string/char*, string/char*) equally To: Alexandre Oliva Cc: Jonathan Wakely via Gcc-patches , whh8b@obs.cr, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, 24 Aug 2022 at 23:39, Alexandre Oliva wrote: > > On Aug 24, 2022, Jonathan Wakely via Gcc-patches wrote: > > > * include/bits/basic_string.h (operator+(const string&, > > const char*)): > > Remove naive implementation. > > * include/bits/basic_string.tcc (operator+(const string&, > > const char*)): > > Add single-allocation implementation. > > ISTM this requires the following additional tweak: > > diff --git a/libstdc++-v3/src/c++11/string-inst.cc b/libstdc++-v3/src/c++11/string-inst.cc > index bfae6d902a1dd..2ec0e9d85f947 100644 > --- a/libstdc++-v3/src/c++11/string-inst.cc > +++ b/libstdc++-v3/src/c++11/string-inst.cc > @@ -58,6 +58,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > template class basic_string; > template S operator+(const C*, const S&); > + template S operator+(const S&, const C*); > template S operator+(C, const S&); > template S operator+(const S&, const S&); > > > Without this, I'm getting undefined references to this specialization in > libstdc++.so, that I tracked down to a std::system_error ctor in > cxx11-ios_failure.o. I got this while testing another patch that might > be the reason why the template instantiation doesn't get inlined, but... > we can't depend on its being inlined, can we? Right. But adding that will cause another symbol to be exported, probably with the wrong symbol version. To fix https://gcc.gnu.org/PR106735 I'm just going to revert it for now, and revisit in the morning.