From patchwork Sat Jan 3 03:19:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 425088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id F12CD1400DD for ; Sat, 3 Jan 2015 14:19:51 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=GWo1SW3qaNeGAfGddiqWhcMbeDLbXeS/ZlB9p0W1Bm0 LM43cGTvxpRjWJXeR0/StglfzlyW8Ayx9YIRSHpsMk69RPVVyo64o3biY5Uo/o5I KyQo2LFEVFsvoJAVPmJtJkYq1pESLCXPY1bXaecXH+Fym8ykSZeVzKCgib2y01nA = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=NqqrC/KxnxOf0XFo2VBFQjEvYDI=; b=V2LiE+lyjmXvrkCoQ K4f3d0rwx0n/7SeUK/XhWBCbcjKxtnR66uxEUaQc4hqNhIS2yqLJh1LUwoSQXnUs 3fSsJlZSRErJb0X4Mf2FnqOH/i86z99yEJQcOrW5OTvuy01JqxgREpYG4EOR/qtZ krJ3LvxfO7yg1ZIxJX0bKflcxM= Received: (qmail 11404 invoked by alias); 3 Jan 2015 03:19:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11388 invoked by uid 89); 3 Jan 2015 03:19:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 03 Jan 2015 03:19:36 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1Y7FFU-0001Ii-0r from Sandra_Loosemore@mentor.com ; Fri, 02 Jan 2015 19:19:32 -0800 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Fri, 2 Jan 2015 19:19:31 -0800 Message-ID: <54A75FC0.7070903@codesourcery.com> Date: Fri, 2 Jan 2015 20:19:28 -0700 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: GCC Patches CC: Jan Hubicka Subject: [doc, committed] fix typos in docs/comments for devirtualization optimizations I noticed a number of typos in the documentation for the devirtualization optimization options in invoke.texi, also in the short option description in common.opt. When I was browsing the code to make sure I understood the purpose of these options, I noticed that there were very many more typos in the comments in ipa-devirt.c. I've made a pass through everything to clean things up and checked in this patch under the "obvious fix" rule. There were a couple things I didn't address here: * I suggest renaming the function type_known_to_have_no_deriavations_p to type_known_to_have_no_derivations_p. (I suppose such a code change requires a complete bootstrap and regression test.... I'm lazy....) * I noticed the comments documenting possible_polymorphic_call_targets appear to be describing parameters and behavior that aren't there any more. I'll leave fixing that up to somebody who has a deeper understanding of the code. -Sandra 2015-01-02 Sandra Loosemore gcc/ * doc/invoke.texi (Option Summary): Fix spelling of -fdevirtualize-at-ltrans. ([-fdevirtualize]): Fix markup. ([-fdevirtualize-speculatively]): Fix typo. ([-fdevirtualize-at-ltrans]): Likewise. Make description less implementor-speaky. * common.opt (fdevirtualize-at-ltrans): Likewise. * ipa-devirt.c: Fix typos in comments throughout the file. (ipa_devirt): Fix typos in format strings for dump output. Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 219154) +++ gcc/doc/invoke.texi (working copy) @@ -378,7 +378,7 @@ Objective-C and Objective-C++ Dialects}. -fcx-limited-range @gol -fdata-sections -fdce -fdelayed-branch @gol -fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol --devirtualize-at-ltrans -fdse @gol +-fdevirtualize-at-ltrans -fdse @gol -fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol -ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol @@ -7772,7 +7772,7 @@ are enabled independently at different o @opindex fdevirtualize Attempt to convert calls to virtual functions to direct calls. This is done both within a procedure and interprocedurally as part of -indirect inlining (@code{-findirect-inlining}) and interprocedural constant +indirect inlining (@option{-findirect-inlining}) and interprocedural constant propagation (@option{-fipa-cp}). Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. @@ -7781,14 +7781,15 @@ Enabled at levels @option{-O2}, @option{ Attempt to convert calls to virtual functions to speculative direct calls. Based on the analysis of the type inheritance graph, determine for a given call the set of likely targets. If the set is small, preferably of size 1, change -the call into an conditional deciding on direct and indirect call. The +the call into a conditional deciding between direct and indirect calls. The speculative calls enable more optimizations, such as inlining. When they seem useless after further optimization, they are converted back into original form. @item -fdevirtualize-at-ltrans @opindex fdevirtualize-at-ltrans -Perform extra streaming needed for agressive devirtualization during LTO local -transformation stage. This option enables more devirtualization but +Stream extra information needed for aggressive devirtualization when running +the link-time optimizer in local transformation mode. +This option enables more devirtualization but significantly increases the size of streamed data. For this reason it is disabled by default. Index: gcc/common.opt =================================================================== --- gcc/common.opt (revision 219153) +++ gcc/common.opt (working copy) @@ -1064,7 +1064,7 @@ Delete useless null pointer checks fdevirtualize-at-ltrans Common Report Var(flag_ltrans_devirtualize) -Perofrm extra streaming to support more agressive devirtualization at LTO ltrans stage. +Stream extra data to support more aggressive devirtualization in LTO local transformation mode fdevirtualize-speculatively Common Report Var(flag_devirtualize_speculatively) Optimization Index: gcc/ipa-devirt.c =================================================================== --- gcc/ipa-devirt.c (revision 219153) +++ gcc/ipa-devirt.c (working copy) @@ -19,7 +19,7 @@ You should have received a copy of the G along with GCC; see the file COPYING3. If not see . */ -/* Brief vocalburary: +/* Brief vocabulary: ODR = One Definition Rule In short, the ODR states that: 1 In any translation unit, a template, type, function, or object can @@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. BINFO This is the type inheritance information attached to each tree - RECORD_TYPE by the C++ frotend. It provides information about base + RECORD_TYPE by the C++ frontend. It provides information about base types and virtual tables. BINFO is linked to the RECORD_TYPE by TYPE_BINFO. @@ -75,7 +75,7 @@ along with GCC; see the file COPYING3. or from DECL_VINDEX of a given virtual table. polymorphic (indirect) call - This is callgraph represention of virtual method call. Every + This is callgraph representation of virtual method call. Every polymorphic call contains otr_type and otr_token taken from original OBJ_TYPE_REF at callgraph construction time. @@ -196,17 +196,17 @@ static bool odr_violation_reported = fal static hash_set *cached_polymorphic_call_targets; /* The node of type inheritance graph. For each type unique in - One Defintion Rule (ODR) sense, we produce one node linking all + One Definition Rule (ODR) sense, we produce one node linking all main variants of types equivalent to it, bases and derived types. */ struct GTY(()) odr_type_d { /* leader type. */ tree type; - /* All bases; built only for main variants of types */ + /* All bases; built only for main variants of types. */ vec GTY((skip)) bases; - /* All derrived types with virtual methods seen in unit; - built only for main variants oftypes */ + /* All derived types with virtual methods seen in unit; + built only for main variants of types. */ vec GTY((skip)) derived_types; /* All equivalent types, if more than one. */ @@ -246,7 +246,7 @@ type_all_derivations_known_p (const_tree return (decl_function_context (TYPE_NAME (t)) != NULL); } -/* Return TURE if type's constructors are all visible. */ +/* Return TRUE if type's constructors are all visible. */ static bool type_all_ctors_visible_p (tree t) @@ -367,7 +367,7 @@ odr_hasher::hash (const value_type *odr_ /* For languages with One Definition Rule, work out if types are the same based on their name. - This is non-trivial for LTO where minnor differences in + This is non-trivial for LTO where minor differences in the type representation may have prevented type merging to merge two copies of otherwise equivalent type. @@ -397,7 +397,7 @@ types_same_for_odr (const_tree type1, co /* ODR name of the type is set in DECL_ASSEMBLER_NAME of its TYPE_NAME. - Ideally we should never meed types without ODR names here. It can however + Ideally we should never need types without ODR names here. It can however happen in two cases: 1) for builtin types that are not streamed but rebuilt in lto/lto-lang.c @@ -410,8 +410,8 @@ types_same_for_odr (const_tree type1, co if ((!TYPE_NAME (type1) || !DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (type1))) || (!TYPE_NAME (type2) || !DECL_ASSEMBLER_NAME_SET_P (TYPE_NAME (type2)))) { - /* See if types are obvoiusly different (i.e. different codes - or polymorphis wrt non-polymorphic). This is not strictly correct + /* See if types are obviously different (i.e. different codes + or polymorphic wrt non-polymorphic). This is not strictly correct for ODR violating programs, but we can't do better without streaming ODR names. */ if (TREE_CODE (type1) != TREE_CODE (type2)) @@ -424,8 +424,8 @@ types_same_for_odr (const_tree type1, co != (BINFO_VTABLE (TYPE_BINFO (type2)) == NULL_TREE)) return false; - /* At the moment we have no way to establish ODR equivlaence at LTO - other than comparing virtual table pointrs of polymorphic types. + /* At the moment we have no way to establish ODR equivalence at LTO + other than comparing virtual table pointers of polymorphic types. Eventually we should start saving mangled names in TYPE_NAME. Then this condition will become non-trivial. */ @@ -508,7 +508,7 @@ odr_hasher::remove (value_type *v) ggc_free (v); } -/* ODR type hash used to lookup ODR type based on tree type node. */ +/* ODR type hash used to look up ODR type based on tree type node. */ typedef hash_table odr_hash_type; static odr_hash_type *odr_hash; @@ -565,7 +565,7 @@ odr_subtypes_equivalent_p (tree t1, tree return true; } - /* Component types, builtins and possibly vioalting ODR types + /* Component types, builtins and possibly violating ODR types have to be compared structurally. */ if (TREE_CODE (t1) != TREE_CODE (t2)) return false; @@ -586,7 +586,7 @@ odr_subtypes_equivalent_p (tree t1, tree } /* Compare two virtual tables, PREVAILING and VTABLE and output ODR - violation warings. */ + violation warnings. */ void compare_virtual_tables (varpool_node *prevailing, varpool_node *vtable) @@ -1445,8 +1445,8 @@ type_known_to_have_no_deriavations_p (tr && !get_odr_type (t, true)->derived_types.length()))); } -/* Dump ODR type T and all its derrived type. INDENT specify indentation for - recusive printing. */ +/* Dump ODR type T and all its derived types. INDENT specifies indentation for + recursive printing. */ static void dump_odr_type (FILE *f, odr_type t, int indent=0) @@ -1517,7 +1517,7 @@ dump_type_inheritance_graph (FILE *f) } /* Given method type T, return type of class it belongs to. - Lookup this pointer and get its type. */ + Look up this pointer and get its type. */ tree method_class_type (const_tree t) @@ -1664,7 +1664,7 @@ maybe_record_node (vec & target_node = cgraph_node::get (target); - /* Preffer alias target over aliases, so we do not get confused by + /* Prefer alias target over aliases, so we do not get confused by fake duplicates. */ if (target_node) { @@ -1676,7 +1676,7 @@ maybe_record_node (vec & } /* Method can only be called by polymorphic call if any - of vtables refering to it are alive. + of vtables referring to it are alive. While this holds for non-anonymous functions, too, there are cases where we want to keep them in the list; for example @@ -1686,7 +1686,7 @@ maybe_record_node (vec & Currently we ignore these functions in speculative devirtualization. ??? Maybe it would make sense to be more aggressive for LTO even - eslewhere. */ + elsewhere. */ if (!flag_ltrans && type_in_anonymous_namespace_p (DECL_CONTEXT (target)) && (!target_node @@ -1714,12 +1714,12 @@ maybe_record_node (vec & *completep = false; } -/* See if BINFO's type match OUTER_TYPE. If so, lookup +/* See if BINFO's type matches OUTER_TYPE. If so, look up BINFO of subtype of OTR_TYPE at OFFSET and in that BINFO find method in vtable and insert method to NODES array or BASES_TO_CONSIDER if this array is non-NULL. Otherwise recurse to base BINFOs. - This match what get_binfo_at_offset does, but with offset + This matches what get_binfo_at_offset does, but with offset being unknown. TYPE_BINFOS is a stack of BINFOS of types with defined @@ -1760,7 +1760,7 @@ record_target_from_binfo (vec = 0; i--) if (BINFO_OFFSET (type_binfos[i]) == BINFO_OFFSET (binfo)) @@ -1815,7 +1815,7 @@ record_target_from_binfo (vec type)) @@ -2313,7 +2313,7 @@ possible_polymorphic_call_targets (tree = get_odr_type (context.speculative_outer_type, true)->type; } - /* Lookup cached answer. */ + /* Look up cached answer. */ key.type = type; key.otr_token = otr_token; key.speculative = speculative; @@ -2362,7 +2362,8 @@ possible_polymorphic_call_targets (tree odr_type speculative_outer_type; bool speculation_complete = true; - /* First insert target from type itself and check if it may have derived types. */ + /* First insert target from type itself and check if it may have + derived types. */ speculative_outer_type = get_odr_type (context.speculative_outer_type, true); if (TYPE_FINAL_P (speculative_outer_type->type)) context.speculative_maybe_derived_type = false; @@ -2498,8 +2499,8 @@ possible_polymorphic_call_targets (tree if (!speculative) { /* Destructors are never called through construction virtual tables, - because the type is always known. One of entries may be cxa_pure_virtual - so look to at least two of them. */ + because the type is always known. One of entries may be + cxa_pure_virtual so look to at least two of them. */ if (context.maybe_in_construction) for (i =0 ; i < MIN (nodes.length (), 2); i++) if (DECL_CXX_DESTRUCTOR_P (nodes[i]->decl)) @@ -2705,16 +2706,16 @@ likely_target_p (struct cgraph_node *n) return false; if (n->frequency < NODE_FREQUENCY_NORMAL) return false; - /* If there are no virtual tables refering the target alive, - the only way the target can be called is an instance comming from other - compilation unit; speculative devirtualization is build around an + /* If there are no live virtual tables referring the target, + the only way the target can be called is an instance coming from other + compilation unit; speculative devirtualization is built around an assumption that won't happen. */ if (!referenced_from_vtable_p (n)) return false; return true; } -/* Compare type warning records P1 and P2 and chose one with larger count; +/* Compare type warning records P1 and P2 and choose one with larger count; helper for qsort. */ int @@ -2730,7 +2731,7 @@ type_warning_cmp (const void *p1, const return t2->count - t1->count; } -/* Compare decl warning records P1 and P2 and chose one with larger count; +/* Compare decl warning records P1 and P2 and choose one with larger count; helper for qsort. */ int @@ -2747,7 +2748,7 @@ decl_warning_cmp (const void *p1, const } -/* Try speculatively devirtualize call to OTR_TYPE with OTR_TOKEN with +/* Try to speculatively devirtualize call to OTR_TYPE with OTR_TOKEN with context CTX. */ struct cgraph_node * @@ -2785,7 +2786,7 @@ try_speculative_devirtualization (tree o /* The ipa-devirt pass. When polymorphic call has only one likely target in the unit, - turn it into speculative call. */ + turn it into a speculative call. */ static unsigned int ipa_devirt (void) @@ -2860,7 +2861,7 @@ ipa_devirt (void) if (e->speculative) { if (dump_file) - fprintf (dump_file, "Call is aready speculated\n\n"); + fprintf (dump_file, "Call is already speculated\n\n"); nspeculated++; /* When dumping see if we agree with speculation. */ @@ -2915,7 +2916,7 @@ ipa_devirt (void) if (!likely_target->definition) { if (dump_file) - fprintf (dump_file, "Target is not an definition\n\n"); + fprintf (dump_file, "Target is not a definition\n\n"); nnotdefined++; continue; }