public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: David Malcolm <dmalcolm@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/2] libcpp: Avoid unnecessary ad-hoc uses for large source files
Date: Mon, 21 Dec 2015 20:10:00 -0000	[thread overview]
Message-ID: <56785CB0.7000808@redhat.com> (raw)
In-Reply-To: <1450470070-31069-1-git-send-email-dmalcolm@redhat.com>

On 12/18/2015 01:21 PM, David Malcolm wrote:
> When debugging PR c++/68819 I noticed an inefficiency during
> the handling of locations > LINE_MAP_MAX_LOCATION_WITH_COLS.
> When combining ranges for locations with
>    start == caret == finish (with a NULL data ptr)
> get_combined_adhoc_loc was always building an ad-hoc entry
> rather than simply returning the location.
>
> Normally can_be_stored_compactly_p returns true for such triples,
> but it returns false for locations above
> LINE_MAP_MAX_LOCATION_WITH_COLS (as the range-packing code isn't
> designed to handle the latter).  There's a followup test within
> get_combined_adhoc_loc for detecting the start == caret == finish
> case, but I'd conditionalized it on the location being one of the
> two reserved locations:
>     locus < RESERVED_LOCATION_COUNT
>
> That condition has been there since I introduced range-packing
> (as part ofr230331).  I believe at the time I didn't realize there
> was any other way for such a location triple to fail
> can_be_stored_compactly_p.
>
> These location triples occur a lot where we're in this mode:
> every token, and every expression that fits on one line,
> so this is wasteful.
>
> Removing the locus < RESERVED_LOCATION_COUNT part of the
> condition allows us to avoid using the ad-hoc table for these
> cases.
>
> Successfully bootstrapped&regrtested on x86_64-pc-linux-gnu
> in combination with the following patch.
>
> libcpp/ChangeLog:
> 	* line-map.c (get_combined_adhoc_loc): Remove condition
> 	on locus < RESERVED_LOCATION_COUNT when considering
> 	whether a caret == start == finish location can be
> 	simply stored as the caret location.
OK.
jeff

      parent reply	other threads:[~2015-12-21 20:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 20:01 David Malcolm
2015-12-18 20:01 ` [PATCH 2/2] PR c++/68819: libcpp fallbacks and -Wmisleading-indentation David Malcolm
2015-12-21 21:10   ` Jeff Law
2015-12-21 21:20     ` Jakub Jelinek
2016-01-06 20:02       ` David Malcolm
2016-01-07  8:41         ` Jakub Jelinek
2016-01-06 19:54     ` David Malcolm
2016-01-08 21:20     ` [PATCH] PR preprocessor/69177 and PR c++/68819: libcpp fallbacks and -Wmisleading-indentation (v2) David Malcolm
2016-01-14 18:50       ` Jeff Law
2015-12-21 20:10 ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56785CB0.7000808@redhat.com \
    --to=law@redhat.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).