Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
Hi Mike, Jack, On 17 Jun 2011, at 20:24, Jack Howarth wrote: On Fri, Jun 17, 2011 at 10:43:07AM -0700, Mike Stump wrote: On Jun 16, 2011, at 7:21 PM, Jack Howarth wrote: The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the new -pie default of the linker. The attached patch accomplishes this by passing -no_pie on SYSTEMSPEC for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I included it in the triplet match to simplify the syntax. Bootstrap and tested on x86_64-apple-darwin11. Okay for gcc trunk? The darwin aspects of this seem right to me. I'm less familiar with the SYSTEMSPEC bit in libjava, someone want to give a quick comment on if this is the right knob to twist? Since SYSTEMSPEC in configure.ac is setting system specific options for libgcj.spec.in, it seemed the most rational place to append -no_pie to (and we already had a darwin entry in the case statement). FYI, I also tried a different approach of not appending -no_pie SYSTEMSPEC on darwin but instead using... maybe I need more coffee .. and the gcc gathering was very sociable... but... ... It seems to me that switching pie off in libjava spec == switching pie off for every java program. (i.e. it doesn't seem equivalent to BOOT_CFLAGS, but maybe I'm still missing something). Roughly, there are unresolved issues with position independent code with the garbage collector (or was it a problem with some unknown bit in the compiler), and this just turns off a new OS default for java to work around the issue. I hope that's an at least half way accurate description. We're aiming to have the default for C be - fpie, but for java, no pie. For the C compiler, we must build the compiler without -pie in order for PCH to work. It is reasonable to turn off pie in the java compiler as well. Jack, do we have a PR number for this? If so, please include in the changelog in the usual spot. I plan on opening a PR shortly, but I was hoping to be able to reproduce the same failures under linux using a bootstrap with the compiler defaulted to -fPIC code generation and the inverse change applied to linux of... The thing that is not clear is this. libjava (and boehm-gc) with pie passes on d9 and d10 (modulo a test- suite related kludge); so it doesn't seem that there's a fundamental problem. (c.f. PCH, which won't work with pie, by definition from its design). AFAIR ecj1 is not involved in the libjava tests - because they don't actually compile from .java. (I'm not debating that there is a problem with ecj1 - but maybe that needs to be solved in the explicit build instructions for that executable). So is this 'fix' a work-around for a tool bug... or is there really a lurking problem in boehm-gc/libjava that is uncovered by darwin11? we seem to be switching off pie without actually pointing at the reason for doing so... Iain
Re: [PATCH]: Pass -no_pie on SYSTEMSPEC for darwin11
Hi Jack, On 18 Jun 2011, at 03:57, Jack Howarth wrote: On Fri, Jun 17, 2011 at 12:04:34PM +0100, IainS wrote: Hi Jack, === kludge to suppress pie for for dylibs (use in place of the darwin9.h hunk from the attachment on PR49371). Iain, This change should be unncessary since -pie on the linker only operates on executables (hence the name PIE). On darwin < 11 .. which don't default to linking pie: As stated, it's a kludge to allow fpie to be put as a test-suite option... ... since the options are passed verbatim to library builds, all the dylib builds fail otherwise ... if there is an alternate way of filtering 'fpie/fPIE' out of dylib builds, that could be more globally applied the to the test suite, that would be a good fix to make. (the kludge is expedient to test the hypothesis that pie works with libjava on darwin 9 & 10 -- FAOD: I am not suggesting it for trunk)... Iain Index: gcc/config/darwin9.h === --- gcc/config/darwin9.h(revision 175110) +++ gcc/config/darwin9.h(working copy) @@ -35,6 +35,12 @@ along with GCC; see the file COPYING3. If not see /* Tell collect2 to run dsymutil for us as necessary. */ #define COLLECT_RUN_DSYMUTIL 1 +#undef PIE_SPEC +#define PIE_SPEC \ + "%{fpie|pie|fPIE: %{!Zdynamiclib: \ + %{mdynamic-no-pic: %n'-mdynamic-no-pic' overrides '-pie', '- fpie' or '-fPIE'; \ + :-pie}}}" + #undef ASM_OUTPUT_ALIGNED_COMMON #define ASM_OUTPUT_ALIGNED_COMMON(FILE, NAME, SIZE, ALIGN) \ do { \
varpool alias reorg
Hi, this patch makes symetric changes to varpool as did the prevoius series to cgraph. Basically the aliases are now represented as separate varpool nodes with alias reference to the variable they refer to, with some infrastructure to walk the alias references as needed. Bootstrapped/regtested x86_64-linux, comitted. Honza * lto-symtab.c (lto_varpool_replace_node): Remove code handling extra name aliases. (lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_merge_cgraph_nodes): Update alias_of pointers. * cgraphbuild.c (record_reference): Remove extra body alias code. (mark_load): Likewise. (mark_store): Likewise. * cgraph.h (varpool_node): Remove extra_name filed; add alias_of and extraname_alias. (varpool_create_variable_alias, varpool_for_node_and_aliases): Declare. (varpool_alias_aliased_node): New inline function. (varpool_variable_node): New function. * cgraphunit.c (handle_alias_pairs): Handle also variable aliases. * ipa-ref.c (ipa_record_reference): Allow aliases on variables. * lto-cgraph.c (lto_output_varpool_node): Update streaming. (input_varpool_node): Likewise. * lto-streamer-out.c (produce_symtab): Remove extra name aliases. (varpool_externally_visible_p): Remove extra body alias code. (function_and_variable_visibility): Likewise. * tree-ssa-structalias.c (associate_varinfo_to_alias_1): New function. (ipa_pta_execute): Use it. * varpool.c (varpool_remove_node): Remove extra name alias code. (varpool_mark_needed_node): Likewise. (varpool_analyze_pending_decls): Analyze aliases. (assemble_aliases): New functoin. (varpool_assemble_decl): Use it. (varpool_create_variable_alias): New function. (varpool_extra_name_alias): Rewrite. (varpool_for_node_and_aliases): New function. Index: lto-symtab.c === *** lto-symtab.c(revision 175079) --- lto-symtab.c(working copy) *** lto_varpool_replace_node (struct varpool *** 268,299 gcc_assert (!vnode->analyzed || prevailing_node->analyzed); varpool_mark_needed_node (prevailing_node); } - /* Relink aliases. */ - if (vnode->extra_name && !vnode->alias) - { - struct varpool_node *alias, *last; - for (alias = vnode->extra_name; - alias; alias = alias->next) - { - last = alias; - alias->extra_name = prevailing_node; - } - - if (prevailing_node->extra_name) - { - last->next = prevailing_node->extra_name; - prevailing_node->extra_name->prev = last; - } - prevailing_node->extra_name = vnode->extra_name; - vnode->extra_name = NULL; - } gcc_assert (!vnode->finalized || prevailing_node->finalized); gcc_assert (!vnode->analyzed || prevailing_node->analyzed); - /* When replacing by an alias, the references goes to the original - variable. */ - if (prevailing_node->alias && prevailing_node->extra_name) - prevailing_node = prevailing_node->extra_name; ipa_clone_refering (NULL, prevailing_node, &vnode->ref_list); /* Be sure we can garbage collect the initializer. */ --- 268,276 *** lto_symtab_resolve_can_prevail_p (lto_sy *** 445,451 return false; if (e->vnode->finalized) return true; - return e->vnode->alias && e->vnode->extra_name->finalized; } gcc_unreachable (); *** void *** 779,784 --- 755,761 lto_symtab_merge_cgraph_nodes (void) { struct cgraph_node *node; + struct varpool_node *vnode; lto_symtab_maybe_init_hash_table (); htab_traverse (lto_symtab_identifiers, lto_symtab_merge_cgraph_nodes_1, NULL); *** lto_symtab_merge_cgraph_nodes (void) *** 786,791 --- 763,771 if ((node->thunk.thunk_p || node->alias) && node->thunk.alias) node->thunk.alias = lto_symtab_prevailing_decl (node->thunk.alias); + for (vnode = varpool_nodes; vnode; vnode = vnode->next) + if (vnode->alias_of) + vnode->alias_of = lto_symtab_prevailing_decl (vnode->alias_of); } /* Given the decl DECL, return the prevailing decl with the same name. */ Index: cgraphbuild.c === *** cgraphbuild.c (revision 175079) --- cgraphbuild.c (working copy) *** record_reference (tree *tp, int *walk_su *** 87,94 if (lang_hooks.callgraph.analyze_expr) lang_hooks.callgraph.analyze_expr (&decl, walk_subtrees); varpool_mark_needed_node (vnode); - if (vnode->alias && vnode->extra_name) - vnode = vnode->extra_name; ipa_record_reference (NULL, ctx->varpool_node, NULL, vnode,
SRA generates uninitialized var use
Compiling the test case in the patch with -O2 -m32 without the fix, the program will abort. The problem is a var decl whose address is taken is not marked as addressable leading to bad SSA update (missing VUSE). (the triaging used the the .after and .after_cleanup dump diff and found the problem). the test is on going. Ok after testing? Thanks, David sra_bug.p Description: Binary data
Re: Improve DSE in the presence of calls
This seems to have triggered http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49452 on arm-linux-gnueabi Might well be a DUP of PR49429 but I haven't looked at it yet. cheers Ramana
[Ada] Fix compilation error on constant passed as memory operand to Asm
This prevents the compiler from rejecting a constant passed as memory operand to an Asm statement. While this may seem to be a questionable construct, it can be generated by the front-end in specific cases. Tested on i586-suse-linux, applied on the mainline. 2011-06-18 Eric Botcazou * einfo.ads (Address_Taken): Document use for the second argument of Asm_Input and Asm_Output attributes. * sem_attr.adb (Analyze_Attribute) : If the second argument is an entity name, then set Address_Taken on it. : Likewise. * gcc-interface/trans.c (lvalue_required_for_attribute_p): Handle the Attr_Asm_Input and Attr_Asm_Output attributes explicitly. (gnat_to_gnu) : If an operand is going to end up in memory and is a CONST_DECL, retrieve its corresponding VAR_DECL. 2011-06-18 Eric Botcazou * gnat.dg/constant3.adb: New test. -- Eric Botcazou Index: einfo.ads === --- einfo.ads (revision 175136) +++ einfo.ads (working copy) @@ -380,9 +380,11 @@ package Einfo is --Address_Taken (Flag104) -- Present in all entities. Set if the Address or Unrestricted_Access -- attribute is applied directly to the entity, i.e. the entity is the --- entity of the prefix of the attribute reference. Used by Gigi to --- make sure that the address can be meaningfully taken, and also in --- the case of subprograms to control output of certain warnings. +-- entity of the prefix of the attribute reference. Also set if the +-- entity is the second argument of an Asm_Input or Asm_Output attribute, +-- as the construct may entail taking its address. Used by Gigi to make +-- sure that the address can be meaningfully taken, and also in the case +-- of subprograms to control output of certain warnings. --Aft_Value (synthesized) -- Applies to fixed and decimal types. Computes a universal integer Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 175136) +++ gcc-interface/trans.c (working copy) @@ -706,6 +706,8 @@ lvalue_required_for_attribute_p (Node_Id case Attr_First_Bit: case Attr_Last_Bit: case Attr_Bit: +case Attr_Asm_Input: +case Attr_Asm_Output: default: return 1; } @@ -5489,9 +5491,15 @@ gnat_to_gnu (Node_Id gnat_node) mark it addressable. Note that we don't test allows_mem like in the input case below; this is modelled on the C front-end. */ - if (!allows_reg - && !gnat_mark_addressable (output)) - output = error_mark_node; + if (!allows_reg) + { + STRIP_NOPS (output); + if (TREE_CODE (output) == CONST_DECL + && DECL_CONST_CORRESPONDING_VAR (output)) + output = DECL_CONST_CORRESPONDING_VAR (output); + if (!gnat_mark_addressable (output)) + output = error_mark_node; + } } else output = error_mark_node; @@ -5511,9 +5519,15 @@ gnat_to_gnu (Node_Id gnat_node) { /* If the operand is going to end up in memory, mark it addressable. */ - if (!allows_reg && allows_mem - && !gnat_mark_addressable (input)) - input = error_mark_node; + if (!allows_reg && allows_mem) + { + STRIP_NOPS (input); + if (TREE_CODE (input) == CONST_DECL + && DECL_CONST_CORRESPONDING_VAR (input)) + input = DECL_CONST_CORRESPONDING_VAR (input); + if (!gnat_mark_addressable (input)) + input = error_mark_node; + } } else input = error_mark_node; Index: sem_attr.adb === --- sem_attr.adb (revision 175136) +++ sem_attr.adb (working copy) @@ -2243,6 +2243,13 @@ package body Sem_Attr is when Attribute_Asm_Input => Check_Asm_Attribute; + + -- The back-end may need to take the address of E2 + + if Is_Entity_Name (E2) then +Set_Address_Taken (Entity (E2)); + end if; + Set_Etype (N, RTE (RE_Asm_Input_Operand)); @@ -2263,6 +2270,13 @@ package body Sem_Attr is end if; Note_Possible_Modification (E2, Sure => True); + + -- The back-end may need to take the address of E2 + + if Is_Entity_Name (E2) then +Set_Address_Taken (Entity (E2)); + end if; + Set_Etype (N, RTE (RE_Asm_Output_Operand)); --- -- { dg-do compile } -- { dg-options "-O" } with System.Machine_code; use System.Machine_code; procedure Constant3 is c : Integer := -1; r : Integer; procedure Conv (res : out Integer; v : Integer) is v1 : constant Integer := v; begin Asm ("", Integer'Asm_output ("=m", res), Integer'Asm_input("m", v1)); end; pragma Inline_Always (Conv); begin Conv (r, c); end;
[Ada] Do not set TREE_THIS_NOTRAP with address clause
If an object has an address clause, it is handled indirectly, i.e. replaced with a pointer initialized to the address. We were putting TREE_THIS_NOTRAP on the dereferences built to retrieve the real object from the pointer, but this is problematic if the address is invalid, as this means that we cannot properly raise the exception. Tested on i586-suse-linux, applied on the mainline and 4.6 branch. 2011-06-18 Eric Botcazou * gcc-interface/trans.c (Identifier_to_gnu): Don't set TREE_THIS_NOTRAP on a dereference built for a by-ref object if it has an address clause. -- Eric Botcazou Index: gcc-interface/trans.c === --- gcc-interface/trans.c (revision 175171) +++ gcc-interface/trans.c (working copy) @@ -1018,7 +1018,8 @@ Identifier_to_gnu (Node_Id gnat_node, tr else { gnu_result = build_unary_op (INDIRECT_REF, NULL_TREE, gnu_result); - if (TREE_CODE (gnu_result) == INDIRECT_REF) + if (TREE_CODE (gnu_result) == INDIRECT_REF + && No (Address_Clause (gnat_temp))) TREE_THIS_NOTRAP (gnu_result) = 1; }
Empty LTO partition fix
Hi, the empty partitions gets created when node gets assigned to earlier partition. This happens for thunks, aliases and partitioned comdats. Hope this will fix all occurences of the problem. Bootstrapped/regtested x86_64-linux Honza PR lto/23754 * lto.c (lto_1_to_1_map): Don't create empty partitions. (lto_balanced_map): Likewise. Index: lto.c === *** lto.c (revision 175166) --- lto.c (working copy) *** lto_1_to_1_map (void) *** 1516,1522 for (node = cgraph_nodes; node; node = node->next) { ! if (!partition_cgraph_node_p (node)) continue; file_data = node->local.lto_file_data; --- 1516,1523 for (node = cgraph_nodes; node; node = node->next) { ! if (!partition_cgraph_node_p (node) ! || node->aux) continue; file_data = node->local.lto_file_data; *** lto_1_to_1_map (void) *** 1545,1557 npartitions++; } ! if (!node->aux) ! add_cgraph_node_to_partition (partition, node); } for (vnode = varpool_nodes; vnode; vnode = vnode->next) { ! if (!partition_varpool_node_p (vnode)) continue; file_data = vnode->lto_file_data; slot = pointer_map_contains (pmap, file_data); --- 1546,1558 npartitions++; } ! add_cgraph_node_to_partition (partition, node); } for (vnode = varpool_nodes; vnode; vnode = vnode->next) { ! if (!partition_varpool_node_p (vnode) ! || vnode->aux) continue; file_data = vnode->lto_file_data; slot = pointer_map_contains (pmap, file_data); *** lto_1_to_1_map (void) *** 1565,1572 npartitions++; } ! if (!vnode->aux) ! add_varpool_node_to_partition (partition, vnode); } for (node = cgraph_nodes; node; node = node->next) node->aux = NULL; --- 1566,1572 npartitions++; } ! add_varpool_node_to_partition (partition, vnode); } for (node = cgraph_nodes; node; node = node->next) node->aux = NULL; *** lto_balanced_map (void) *** 1675,1682 for (i = 0; i < n_nodes; i++) { ! if (!order[i]->aux) ! add_cgraph_node_to_partition (partition, order[i]); total_size -= inline_summary (order[i])->size; /* Once we added a new node to the partition, we also want to add --- 1675,1683 for (i = 0; i < n_nodes; i++) { ! if (order[i]->aux) ! continue; ! add_cgraph_node_to_partition (partition, order[i]); total_size -= inline_summary (order[i])->size; /* Once we added a new node to the partition, we also want to add *** lto_balanced_map (void) *** 1856,1861 --- 1857,1864 } i = best_i; /* When we are finished, avoid creating empty partition. */ + while (i < n_nodes - 1 && order[i + 1]->aux) + i++; if (i == n_nodes - 1) break; partition = new_partition ("");
[Ada] Fix bugs with volatile and components of aggregate types
This is the usual problem of volatile accesses not preserved under (heavy) optimization. In Ada, we can put pragma Volatile on components of composite types without putting it on the enclosing type itself, but this doesn't really work when you're starting to optimize. Mostly gigi changes, but this plugs a hole in type_internals_preclude_sra_p which already tests TREE_THIS_VOLATILE on fields of record and union types but doesn't perform the equivalent test for array types. Tested on i586-suse-linux, applied on mainline, as obvious for the SRA bits. 2011-06-18 Eric Botcazou * tree-sra.c (type_internals_preclude_sra_p) : Return true if the element type is volatile. ada/ * gcc-interface/decl.c (gnat_to_gnu_component_type): Use GNAT_TYPE local variable throughout. Remove useless call to Base_Type. (gnat_to_gnu_field): Use GNAT_FIELD_TYPE local variable throughout. Take it also into account for the volatileness of the field. Set the TREE_SIDE_EFFECTS flag as well in this case. Reorder some warnings. 2011-06-18 Eric Botcazou * gnat.dg/volatile6.adb: New test. * gnat.dg/volatile7.adb: Likewise. * gnat.dg/volatile8.adb: Likewise. * gnat.dg/volatile9.adb: Likewise. -- Eric Botcazou Index: ada/gcc-interface/decl.c === --- ada/gcc-interface/decl.c (revision 175136) +++ ada/gcc-interface/decl.c (working copy) @@ -5229,7 +5229,8 @@ static tree gnat_to_gnu_component_type (Entity_Id gnat_array, bool definition, bool debug_info_p) { - tree gnu_type = gnat_to_gnu_type (Component_Type (gnat_array)); + const Entity_Id gnat_type = Component_Type (gnat_array); + tree gnu_type = gnat_to_gnu_type (gnat_type); tree gnu_comp_size; /* Try to get a smaller form of the component if needed. */ @@ -5237,7 +5238,7 @@ gnat_to_gnu_component_type (Entity_Id gn || Has_Component_Size_Clause (gnat_array)) && !Is_Bit_Packed_Array (gnat_array) && !Has_Aliased_Components (gnat_array) - && !Strict_Alignment (Component_Type (gnat_array)) + && !Strict_Alignment (gnat_type) && TREE_CODE (gnu_type) == RECORD_TYPE && !TYPE_FAT_POINTER_P (gnu_type) && host_integerp (TYPE_SIZE (gnu_type), 1)) @@ -5301,7 +5302,7 @@ gnat_to_gnu_component_type (Entity_Id gn debug_info_p, gnat_array); } - if (Has_Volatile_Components (Base_Type (gnat_array))) + if (Has_Volatile_Components (gnat_array)) gnu_type = build_qualified_type (gnu_type, TYPE_QUALS (gnu_type) | TYPE_QUAL_VOLATILE); @@ -6716,12 +6717,16 @@ static tree gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, bool definition, bool debug_info_p) { + const Entity_Id gnat_field_type = Etype (gnat_field); + tree gnu_field_type = gnat_to_gnu_type (gnat_field_type); tree gnu_field_id = get_entity_name (gnat_field); - tree gnu_field_type = gnat_to_gnu_type (Etype (gnat_field)); tree gnu_field, gnu_size, gnu_pos; + bool is_volatile += (Treat_As_Volatile (gnat_field) || Treat_As_Volatile (gnat_field_type)); bool needs_strict_alignment -= (Is_Aliased (gnat_field) || Strict_Alignment (Etype (gnat_field)) - || Treat_As_Volatile (gnat_field)); += (is_volatile + || Is_Aliased (gnat_field) + || Strict_Alignment (gnat_field_type)); /* If this field requires strict alignment, we cannot pack it because it would very likely be under-aligned in the record. */ @@ -6737,7 +6742,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, gnu_size = validate_size (Esize (gnat_field), gnu_field_type, gnat_field, FIELD_DECL, false, true); else if (packed == 1) -gnu_size = validate_size (RM_Size (Etype (gnat_field)), gnu_field_type, +gnu_size = validate_size (RM_Size (gnat_field_type), gnu_field_type, gnat_field, FIELD_DECL, false, true); else gnu_size = NULL_TREE; @@ -6829,7 +6834,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, if (gnu_size && !operand_equal_p (gnu_size, TYPE_SIZE (gnu_field_type), 0)) { - if (Is_Atomic (gnat_field) || Is_Atomic (Etype (gnat_field))) + if (Is_Atomic (gnat_field) || Is_Atomic (gnat_field_type)) post_error_ne_tree ("atomic field& must be natural size of type{ (^)}", Last_Bit (Component_Clause (gnat_field)), gnat_field, @@ -6841,7 +6846,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, Last_Bit (Component_Clause (gnat_field)), gnat_field, TYPE_SIZE (gnu_field_type)); - else if (Strict_Alignment (Etype (gnat_field))) + else if (Strict_Alignment (gnat_field_type)) post_error_ne_tree ("size of & with aliased or tagged components not ^ bits", Last_Bit (Component_Clause (gnat_field)), gnat_field, @@ -6854,19 +6859,19 @@ gnat_to_gnu_field (Entity_Id gnat_field, (TRUNC_MOD_EXPR, gnu_pos, bitsize_int (TYPE_ALIGN (gnu_
[Patch, Fortran, committed] PR 49400: [F08] Proc-pointer declaration in BLOCK construct
Hi all, I just committed a trivial one-line patch to allow PROCEDURE declarations inside BLOCK constructs: http://gcc.gnu.org/viewcvs?view=revision&revision=175177 Cheers, Janus
Re: C++ PATCH for c++/49117 (error message regression on conversion failure)
On Tue, Jun 14, 2011 at 01:38:41PM -0400, Jason Merrill wrote: > commit 16136651e85c19a1e8338a0bd1b2b1a453413c23 > Author: Jason Merrill > Date: Tue Jun 14 09:43:25 2011 -0400 > > * error.c (type_to_string): Print typedef-stripped version too. > > diff --git a/gcc/cp/error.c b/gcc/cp/error.c > index 96796c2..22470dc 100644 > --- a/gcc/cp/error.c > +++ b/gcc/cp/error.c > @@ -2632,6 +2632,15 @@ type_to_string (tree typ, int verbose) > >reinit_cxx_pp (); >dump_type (typ, flags); > + if (typ && TYPE_P (typ) && typ != TYPE_CANONICAL (typ) > + && !uses_template_parms (typ)) > +{ > + tree aka = strip_typedefs (typ); > + pp_string (cxx_pp, " {aka"); > + pp_cxx_whitespace (cxx_pp); > + dump_type (aka, flags); > + pp_character (cxx_pp, '}'); > +} >return pp_formatted_text (cxx_pp); > } > This caused FAIL: obj-c++.dg/invalid-type-1.mm -fgnu-runtime (test for errors, line 21) FAIL: obj-c++.dg/invalid-type-1.mm -fgnu-runtime (test for errors, line 24) FAIL: obj-c++.dg/invalid-type-1.mm -fgnu-runtime (test for excess errors) failures, fixed thusly, committed as obvious to trunk and 4.6: 2011-06-18 Jakub Jelinek PR testsuite/49432 * obj-c++.dg/invalid-type-1.mm: Adjust for new error wording. --- gcc/testsuite/obj-c++.dg/invalid-type-1.mm.jj 2010-11-15 18:53:29.0 +0100 +++ gcc/testsuite/obj-c++.dg/invalid-type-1.mm 2011-06-18 14:52:57.873566940 +0200 @@ -18,8 +18,8 @@ id object; /* This is fine. AClass *object1; /* This is fine. */ -Integer *object2; /* { dg-error ".Integer. is not a template" } */ +Integer *object2; /* { dg-error ".Integer {aka int}. is not a template" } */ /* { dg-error ".MyProtocol. was not declared in this scope" "" { target *-*-* } 21 } */ -Integer *object3; /* { dg-error ".Integer. is not a template" } */ +Integer *object3; /* { dg-error ".Integer {aka int}. is not a template" } */ /* { dg-error ".NonExistingProtocol. was not declared in this scope" "" { target *-*-* } 24 } */ Jakub
Re: PING: PATCH: PR other/49325: Incorrect target HAVE_INITFINI_ARRAY check
On Sat, Jun 18, 2011 at 01:24, H.J. Lu wrote: >> Why are you not changing the gcc_AC_ macro and instead introducing >> duplicate code? Perhaps the right solution is to add a final argument >> to the AC_RUN_IFELSE macro (don't know, I should be on holiday and >> hence I do not have the source code at hand :)); in any case this is >> _not_ how you add tests that work for cross compilation. > > This target test needs run-time check. I don't know how to properly > check it for cross compilation and I don't feel comfortable to change > AC_RUN_IFELSE. > > Here is the updated patch to fix gcc_AC_INITFINI_ARRAY instead. Better. However, the test needs to be $build = $target && $build = $host. Should be okay with that change, but please repost. It is also better to change the cross compilation results (the new "else" branch and the final argument to AC_RUN_IFELSE) to "guessing no". Paolo
Re: varpool alias reorg
On Sat, Jun 18, 2011 at 1:32 AM, Jan Hubicka wrote: > Hi, > this patch makes symetric changes to varpool as did the prevoius series to > cgraph. > Basically the aliases are now represented as separate varpool nodes with > alias reference > to the variable they refer to, with some infrastructure to walk the alias > references > as needed. > > Bootstrapped/regtested x86_64-linux, comitted. > > Honza > > * lto-symtab.c (lto_varpool_replace_node): Remove code handling > extra name aliases. > (lto_symtab_resolve_can_prevail_p): Likewise. > (lto_symtab_merge_cgraph_nodes): Update alias_of pointers. > * cgraphbuild.c (record_reference): Remove extra body alias code. > (mark_load): Likewise. > (mark_store): Likewise. > * cgraph.h (varpool_node): Remove extra_name filed; > add alias_of and extraname_alias. > (varpool_create_variable_alias, varpool_for_node_and_aliases): Declare. > (varpool_alias_aliased_node): New inline function. > (varpool_variable_node): New function. > * cgraphunit.c (handle_alias_pairs): Handle also variable aliases. > * ipa-ref.c (ipa_record_reference): Allow aliases on variables. > * lto-cgraph.c (lto_output_varpool_node): Update streaming. > (input_varpool_node): Likewise. > * lto-streamer-out.c (produce_symtab): Remove extra name aliases. > (varpool_externally_visible_p): Remove extra body alias code. > (function_and_variable_visibility): Likewise. > * tree-ssa-structalias.c (associate_varinfo_to_alias_1): New function. > (ipa_pta_execute): Use it. > * varpool.c (varpool_remove_node): Remove extra name alias code. > (varpool_mark_needed_node): Likewise. > (varpool_analyze_pending_decls): Analyze aliases. > (assemble_aliases): New functoin. > (varpool_assemble_decl): Use it. > (varpool_create_variable_alias): New function. > (varpool_extra_name_alias): Rewrite. > (varpool_for_node_and_aliases): New function. This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49463 -- H.J.
Re: [testsuite] dg-final object-size: fail if file does not exist
On Jun 16, 2011, at 5:26 PM, Janis Johnson wrote: > This new fix to object-size, used within dg-final, continues to report > static test errors as ERROR, but reports problems detected at runtime > as UNRESOLVED, writing the reason to the log file. I'm confident that > a missing object file should make the test UNRESOLVED, not as sure about > problems with the size command on a particular target. > > With this change the message from object-size is the same for pass/fail/ > unresolved. > > OK for trunk? Ok.
Re: [PATCH][Revised] Pass -no_pie on SYSTEMSPEC for darwin11
On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote: > The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the > new -pie > default of the linker. The attached patch accomplishes this by passing > -no_pie on SYSTEMSPEC > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I > included it in the > triplet match to simplify the syntax. Bootstrap and tested on > x86_64-apple-darwin11. > Okay for gcc trunk with PR added to comment as requested? > ps This change also works for gcc-4_6-branch in concert with a backport of > r175089 and r175108. I've backported these two to the gcc-4_6-branch. I tried 4.5, but, they'd need to have mh-darwin backported, so I didn't bother.
Re: PING: PATCH: PR other/49325: Incorrect target HAVE_INITFINI_ARRAY check
On Sat, Jun 18, 2011 at 6:29 AM, Paolo Bonzini wrote: > On Sat, Jun 18, 2011 at 01:24, H.J. Lu wrote: >>> Why are you not changing the gcc_AC_ macro and instead introducing >>> duplicate code? Perhaps the right solution is to add a final argument >>> to the AC_RUN_IFELSE macro (don't know, I should be on holiday and >>> hence I do not have the source code at hand :)); in any case this is >>> _not_ how you add tests that work for cross compilation. >> >> This target test needs run-time check. I don't know how to properly >> check it for cross compilation and I don't feel comfortable to change >> AC_RUN_IFELSE. >> >> Here is the updated patch to fix gcc_AC_INITFINI_ARRAY instead. > > Better. However, the test needs to be $build = $target && $build = > $host. Should be okay with that change, but please repost. > > It is also better to change the cross compilation results (the new > "else" branch and the final argument to AC_RUN_IFELSE) to "guessing > no". > > Paolo > This is the patch I checked in. Thanks. -- H.J. --- 2011-06-18 H.J. Lu PR other/49325 * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Properly check if .init_array can be used with .ctors on targets. * configure: Regenerated. diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 index 3eec559..ff38682 100644 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -375,13 +375,115 @@ AC_DEFUN([gcc_AC_INITFINI_ARRAY], [], [ AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support, gcc_cv_initfini_array, [dnl - AC_RUN_IFELSE([AC_LANG_SOURCE([ + if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then +AC_RUN_IFELSE([AC_LANG_SOURCE([ +#ifdef __ia64__ +/* We turn on .preinit_array/.init_array/.fini_array support for ia64 + if it can be used. */ static int x = -1; int main (void) { return x; } int foo (void) { x = 0; } -int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;])], +int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; +#else +extern void abort (); +static int count; + +static void +init1005 () +{ + if (count != 0) +abort (); + count = 1005; +} +void (*const init_array1005[]) () + __attribute__ ((section (".init_array.01005"), aligned (sizeof (void * + = { init1005 }; +static void +fini1005 () +{ + if (count != 1005) +abort (); +} +void (*const fini_array1005[]) () + __attribute__ ((section (".fini_array.01005"), aligned (sizeof (void * + = { fini1005 }; + +static void +ctor1007 () +{ + if (count != 1005) +abort (); + count = 1007; +} +void (*const ctors1007[]) () + __attribute__ ((section (".ctors.64528"), aligned (sizeof (void * + = { ctor1007 }; +static void +dtor1007 () +{ + if (count != 1007) +abort (); + count = 1005; +} +void (*const dtors1007[]) () + __attribute__ ((section (".dtors.64528"), aligned (sizeof (void * + = { dtor1007 }; + +static void +init65530 () +{ + if (count != 1007) +abort (); + count = 65530; +} +void (*const init_array65530[]) () + __attribute__ ((section (".init_array.65530"), aligned (sizeof (void * + = { init65530 }; +static void +fini65530 () +{ + if (count != 65530) +abort (); + count = 1007; +} +void (*const fini_array65530[]) () + __attribute__ ((section (".fini_array.65530"), aligned (sizeof (void * + = { fini65530 }; + +static void +ctor65535 () +{ + if (count != 65530) +abort (); + count = 65535; +} +void (*const ctors65535[]) () + __attribute__ ((section (".ctors"), aligned (sizeof (void * + = { ctor65535 }; +static void +dtor65535 () +{ + if (count != 65535) +abort (); + count = 65530; +} +void (*const dtors65535[]) () + __attribute__ ((section (".dtors"), aligned (sizeof (void * + = { dtor65535 }; + +int +main () +{ + return 0; +} +#endif +])], [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no], -[gcc_cv_initfini_array=no])]) +[gcc_cv_initfini_array=no]) + else + AC_MSG_CHECKING(cross compile... guessing) + gcc_cv_initfini_array=no + fi]) enable_initfini_array=$gcc_cv_initfini_array ]) if test $enable_initfini_array = yes; then
Re: [PATCH][Revised] Pass -no_pie on SYSTEMSPEC for darwin11
On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote: > The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the > new -pie > default of the linker. The attached patch accomplishes this by passing > -no_pie on SYSTEMSPEC > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I > included it in the > triplet match to simplify the syntax. Bootstrap and tested on > x86_64-apple-darwin11. > Okay for gcc trunk with PR added to comment as requested? I've had a chance to review this more in-depth... Ok.
Re: [PATCH][Revised] Pass -no_pie on SYSTEMSPEC for darwin11
On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote: > The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the > new -pie > default of the linker. The attached patch accomplishes this by passing > -no_pie on SYSTEMSPEC > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I > included it in the > triplet match to simplify the syntax. Bootstrap and tested on > x86_64-apple-darwin11. > Okay for gcc trunk with PR added to comment as requested? > Jack > ps This change also works for gcc-4_6-branch in concert with a backport of > r175089 and r175108. > > 2011-06-17 Jack Howarth > > PR target/49461 > * libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11. > * libjava/configure: Regenerate. Checked in r175182, with one additional comment. We still welcome tracking down what exactly doesn't work and a bug report and fix for that, until then, I think life is too short to have java be broken for too long. 2011-06-17 Jack Howarth PR target/49461 * libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11. * libjava/configure: Regenerate. Index: configure.ac === --- configure.ac(revision 175181) +++ configure.ac(revision 175182) @@ -898,9 +898,14 @@ case "${host}" in SYSTEMSPEC="-lunicows $SYSTEMSPEC" fi ;; -*-*-darwin[[912]]*) +*-*-darwin9*) SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" ;; +*-*-darwin[[12]]*) + # Something is incompatible with pie, would be nice to fix it and + # remove -no_pie. PR49461 + SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" +;; *) SYSTEMSPEC= ;;
Re: [PATCH][Revised] Pass -no_pie on SYSTEMSPEC for darwin11
On Sat, Jun 18, 2011 at 08:11:43AM -0700, Mike Stump wrote: > On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote: > > The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the > > new -pie > > default of the linker. The attached patch accomplishes this by passing > > -no_pie on SYSTEMSPEC > > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I > > included it in the > > triplet match to simplify the syntax. Bootstrap and tested on > > x86_64-apple-darwin11. > > Okay for gcc trunk with PR added to comment as requested? > > Jack > > ps This change also works for gcc-4_6-branch in concert with a backport of > > r175089 and r175108. > > > > 2011-06-17 Jack Howarth > > > > PR target/49461 > > * libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11. > > * libjava/configure: Regenerate. > > Checked in r175182, with one additional comment. We still welcome tracking > down what exactly doesn't work and a bug report and fix for that, until then, > I think life is too short to have java be broken for too long. > Mike, Also note Ian's comments on -fPIE/-pie in http://gcc.gnu.org/ml/gcc/2011-06/msg00215.html. Jack > 2011-06-17 Jack Howarth > > PR target/49461 > * libjava/configure.ac (SYSTEMSPEC): Pass -no_pie for darwin11. > * libjava/configure: Regenerate. > > Index: configure.ac > === > --- configure.ac (revision 175181) > +++ configure.ac (revision 175182) > @@ -898,9 +898,14 @@ case "${host}" in > SYSTEMSPEC="-lunicows $SYSTEMSPEC" >fi > ;; > -*-*-darwin[[912]]*) > +*-*-darwin9*) >SYSTEMSPEC="%{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" > ;; > +*-*-darwin[[12]]*) > + # Something is incompatible with pie, would be nice to fix it and > + # remove -no_pie. PR49461 > + SYSTEMSPEC="-no_pie %{!Zdynamiclib:%{!Zbundle:-allow_stack_execute}}" > +;; > *) >SYSTEMSPEC= > ;;
Re: [PATCH][Revised] Pass -no_pie on SYSTEMSPEC for darwin11
On Sat, Jun 18, 2011 at 07:48:51AM -0700, Mike Stump wrote: > On Jun 17, 2011, at 7:49 PM, Jack Howarth wrote: > > The gcj compiler needs to pass -no_pie for linkage on darwin11 due to the > > new -pie > > default of the linker. The attached patch accomplishes this by passing > > -no_pie on SYSTEMSPEC > > for *-*-darwin[12]*. Since Darwin10 supports -no_pie in its linker, I > > included it in the > > triplet match to simplify the syntax. Bootstrap and tested on > > x86_64-apple-darwin11. > > Okay for gcc trunk with PR added to comment as requested? > > > ps This change also works for gcc-4_6-branch in concert with a backport of > > r175089 and r175108. > > I've backported these two to the gcc-4_6-branch. I tried 4.5, but, they'd > need to have mh-darwin backported, so I didn't bother. Mike, We might just create a mh-x86-darwin for gcc 4.5. Currently dragonegg only supports that FSF gcc release so it would be nice to have a clean bootstrap on darwin11 to support that option. Jack ps FYI, I am only suggesting we populate mh-x86-darwin with... # Ensure we don't try and use -pie, as it is incompatible with pch. BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` and skip the... BOOT_CFLAGS += -mdynamic-no-pic bit.
Re: PATCH [7/n]: Prepare x32: Use Use long long builtin for x86-64
On Tue, Jun 14, 2011 at 10:37 AM, Uros Bizjak wrote: > On Tue, Jun 14, 2011 at 6:04 PM, H.J. Lu wrote: > >> long may be 32bit for x86-64. But long long is always 64bit. This >> patch uses long long builtin for 64bit. OK for trunk? >> >> Thanks. >> >> >> H.J. >> --- >> 2011-06-14 H.J. Lu >> >> * longlong.h (count_leading_zeros): Use long long builtin for >> x86-64. >> (count_trailing_zeros): Likewise. >> >> diff --git a/gcc/longlong.h b/gcc/longlong.h >> index 1bab76d..d5c0cd9 100644 >> --- a/gcc/longlong.h >> +++ b/gcc/longlong.h >> @@ -430,8 +430,8 @@ UDItype __umulsidi3 (USItype, USItype); >> : "0" ((UDItype) (n0)), \ >> "1" ((UDItype) (n1)), \ >> "rm" ((UDItype) (dv))) >> -#define count_leading_zeros(count, x) ((count) = __builtin_clzl (x)) >> -#define count_trailing_zeros(count, x) ((count) = __builtin_ctzl (x)) >> +#define count_leading_zeros(count, x) ((count) = __builtin_clzll (x)) >> +#define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x)) >> #define UMUL_TIME 40 >> #define UDIV_TIME 40 >> #endif /* x86_64 */ > > Uh, this is also needed for MingW (LLP64 target). > > The patch is OK for SVN and release branches, but please also wait for > approval from MingW maintainer. > I am checking it in. I will investigate if there is any issue. -- H.J.
[RFC, ARM] Convert thumb1 prologue completely to rtl
I couldn't find anything terribly tricky about the conversion. The existing push_mult pattern would service thumb1 with just a tweak or two to the memory predicate and the length. The existing emit_multi_reg_push wasn't set up to handle a complete switch of registers for unwind info. I thought about trying to merge them, but thought chickened out. I havn't cleaned out the code that is now dead in thumb_pushpop. I'd been thinking about maybe converting epilogues completely to rtl as well, which would allow the function to be deleted completely, rather than incrementally. I'm unsure what testing should be applied. I'm currently doing arm-elf, which does at least have a thumb1 multilib, and uses newlib so I don't have to fiddle with setting up a full native cross environment. What else should be done? arm-eabi? This is the only substantive bit of code left that tries to emit dwarf2 unwind info while emitting assembly as text. So I'd like to get rid of this as soon as possible... r~ * config/arm/arm.c (arm_output_function_prologue): Don't call thumb1_output_function_prologue. (arm_expand_prologue): Avoid dead store. (number_of_first_bit_set): Use ctz_hwi. (thumb1_emit_multi_reg_push): New. (thumb1_expand_prologue): Merge thumb1_output_function_prologue to emit the entire prologue as rtl. (thumb1_output_interwork): Split out from thumb1_output_function_prologue. (thumb1_output_function_prologue): Remove. (arm_attr_length_push_multi): Handle thumb1. * config/arm/arm.md (VUNSPEC_THUMB1_INTERWORK): New. (prologue_thumb1_interwork): New. (*push_multi): Allow thumb1; use push_mult_memory_operand. * config/arm/predicates.md (push_mult_memory_operand): New. diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 2fd75fb..55a23e9 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -172,6 +172,7 @@ extern void arm_init_expanders (void); extern const char *thumb_unexpanded_epilogue (void); extern void thumb1_expand_prologue (void); extern void thumb1_expand_epilogue (void); +extern const char *thumb1_output_interwork (void); #ifdef TREE_CODE extern int is_called_in_ARM_mode (tree); #endif diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 547acc8..dec2619 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -126,7 +126,6 @@ static tree arm_handle_notshared_attribute (tree *, tree, tree, int, bool *); #endif static void arm_output_function_epilogue (FILE *, HOST_WIDE_INT); static void arm_output_function_prologue (FILE *, HOST_WIDE_INT); -static void thumb1_output_function_prologue (FILE *, HOST_WIDE_INT); static int arm_comp_type_attributes (const_tree, const_tree); static void arm_set_default_type_attributes (tree); static int arm_adjust_cost (rtx, rtx, rtx, int); @@ -14435,11 +14434,9 @@ arm_output_function_prologue (FILE *f, HOST_WIDE_INT frame_size) { unsigned long func_type; + /* ??? Do we want to print some of the below anyway? */ if (TARGET_THUMB1) -{ - thumb1_output_function_prologue (f, frame_size); - return; -} +return; /* Sanity check. */ gcc_assert (!arm_ccfsm_state && !arm_target_insn); @@ -15737,7 +15734,7 @@ arm_expand_prologue (void) /* Interrupt functions must not corrupt any registers. Creating a frame pointer however, corrupts the IP register, so we must push it first. */ - insn = emit_multi_reg_push (1 << IP_REGNUM); + emit_multi_reg_push (1 << IP_REGNUM); /* Do not set RTX_FRAME_RELATED_P on this insn. The dwarf stack unwinding code only wants to see one @@ -19976,14 +19973,73 @@ arm_expand_builtin (tree exp, inline static int number_of_first_bit_set (unsigned mask) { - int bit; + return ctz_hwi (mask); +} + +/* Like emit_multi_reg_push, but allowing for a different set of + registers to be described as saved. MASK is the set of registers + to be saved; REAL_REGS is the set of registers to be described as + saved. If REAL_REGS is 0, only describe the stack adjustment. */ - for (bit = 0; - (mask & (1 << bit)) == 0; - ++bit) -continue; +static rtx +thumb1_emit_multi_reg_push (unsigned long mask, unsigned long real_regs) +{ + unsigned long regno; + rtx par[10], tmp, reg, insn; + int i, j; + + /* Build the parallel of the registers actually being stored. */ + for (i = 0; mask; ++i, mask &= mask - 1) +{ + regno = ctz_hwi (mask); + reg = gen_rtx_REG (SImode, regno); - return bit; + if (i == 0) + tmp = gen_rtx_UNSPEC (BLKmode, gen_rtvec (1, reg), UNSPEC_PUSH_MULT); + else + tmp = gen_rtx_USE (VOIDmode, reg); + + par[i] = tmp; +} + + tmp = plus_constant (stack_pointer_rtx, -4 * i); + tmp = gen_rtx_PRE_MODIFY (Pmode, stack_pointer_rtx, tmp); + tmp = gen_frame_mem (BLKmode, tmp); + tmp =
Re: Improve DSE in the presence of calls
The gimple for test2_31 before RTL expansion contains: # .MEMD.2034_2 = VDEF <.MEMD.2034_1(D)> s1D.2035 = s1D.1255; The RHS is a PARM_DECL. It doesn't have TREE_ADDRESSABLE and the LHS has, which makes sense. But then the move is translated to memcpy but the src memory location is still considered not addressable. Setting TREE_ADDRESSABLE to RHS should fix this bug. I don't know which is the best place to that though. At the point when it decides to use memcpy to do the copying in emit_block_move_hints, we are dealing with temporaries and we don't have the src TREE lying around. Is passing the tree EXP to emit_block_move from store_expr a reasonable approach? -Easwaran On Fri, Jun 17, 2011 at 2:16 PM, Easwaran Raman wrote: > This patch seems to break ia64 and some other targets. I have updated > Bug 49429 with a test case triage. It looks like for some EXPR, > may_be_aliased returns incorrect value and hence can_escape > incorrectly concludes the variable can't escape resulting in removal > of useful stores. > > > (So can_escape() returns false. But later on, in the same BB, I see: > > In the following list of instructions, > > (insn 4 3 6 2 (set (mem/s/c:DI (reg/f:DI 341) [2 s1+0 S8 A64]) > (reg:DI 112 in0)) y.c:23 5 {movdi_internal} > (expr_list:REG_DEAD (reg:DI 112 in0) > (nil))) > > ... > > (insn 36 30 37 2 (set (reg:DI 120 out0) > (reg/f:DI 357)) 5 {movdi_internal} > (expr_list:REG_EQUAL (plus:DI (reg/f:DI 328 sfp) > (const_int 62 [0x3e])) > (nil))) > (insn 37 36 38 2 (set (reg:DI 121 out1) > (reg/f:DI 341)) 5 {movdi_internal} > (expr_list:REG_DEAD (reg/f:DI 341) > (expr_list:REG_EQUAL (plus:DI (reg/f:DI 328 sfp) > (const_int 96 [0x60])) > (nil > (insn 38 37 39 2 (set (reg:DI 122 out2) > (const_int 31 [0x1f])) 5 {movdi_internal} > (nil)) > (call_insn 39 38 42 2 (parallel [ > (set (reg:DI 8 r8) > (call (mem:DI (symbol_ref:DI ("memcpy") [flags 0x41] > ) [0 memcpy S8 A64]) > (const_int 1 [0x1]))) > (clobber (reg:DI 320 b0)) > (clobber (scratch:DI)) > (clobber (scratch:DI)) > ]) 332 {call_value_gp} > (expr_list:REG_DEAD (reg:DI 122 out2) > (expr_list:REG_DEAD (reg:DI 121 out1) > (expr_list:REG_DEAD (reg:DI 120 out0) > (expr_list:REG_UNUSED (reg:DI 8 r8) > (expr_list:REG_EH_REGION (const_int 0 [0]) > (nil)) > (expr_list:REG_DEP_TRUE (use (reg:DI 1 r1)) > (expr_list:REG_DEP_TRUE (use (reg:DI 122 out2)) > (expr_list:REG_DEP_TRUE (use (reg:DI 121 out1)) > (expr_list:REG_DEP_TRUE (use (reg:DI 120 out0)) > (nil)) > > > for the memory expression > > (set (mem/s/c:DI (reg/f:DI 341) [2 s1+0 S8 A64]) > (reg:DI 112 in0)) > > may_be_aliased() returns false, but register 341 is passed as the > second parameter to memcpy. I suspect this is a bug elsewhere which is > exposed by this patch. If someone knows why this might be happening, I > can tighten the can_escape() function appropriately. > > Thanks, > Easwaran > > > > On Tue, Jun 14, 2011 at 9:34 AM, Jeff Law wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 05/10/11 13:18, Easwaran Raman wrote: >> > I am not sure I understand the problem here. If there is a wild read > from asm, the instruction has the wild_read flag set. The if statement > checks if that flag is set and if so it clears the bitmap - which was > the original behavior. Originally, only if read_rec is non NULL you > need to recompute the kill set. Now, even if read_rec is NULL, > non_frame_wild_read could be set requiring the kill set to be > modified, which is what this patch does. In fact, isn't what you have > written above the equivalent to what is in the patch as '/* Leave this > clause unchanged */' is the same as > > if (dump_file) > fprintf (dump_file, "regular read\n"); > scan_reads_nospill (insn_info, v, NULL); > > > -Easwaran > >>> Ping. I have changed the test case to use int and added another test case that shows DSE doesn't happen when the struct instance is volatile (wild_read gets set in that case) >>> >>> >>> What's the purpose behind using unit64_t in the testcase? Somehow I >>> suspect using int64_t means the test is unlikely not going to work >>> across targets with different word sizes. >> Sorry for the exceedingly long wait. Things have been a bit crazy the >> last several weeks. >> >> On a positive note, re-reading things now I think my objection/comment >> was mis-guided. >> >> Patch approved, and again, sorry for the absurdly long period of >> non-responsiveness. >> >> jeff >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v1.4.11 (GNU/Linux) >> Comment: Using GnuPG with Fedora
Re: __sync_swap* with acq/rel/full memory barrier semantics
On 06/17/2011 02:12 PM, Andrew MacLeod wrote: > --- machmode.h(working copy) > *** extern enum machine_mode ptr_mode; > *** 275,278 > --- 275,291 > /* Target-dependent machine mode initialization - in insn-modes.c. */ > extern void init_adjust_machine_modes (void); > > + /* Memory model types for the __sync_mem* builtins. > +This must match the order in libstdc++-v3/include/bits/atomic_base.h. */ > + enum memmodel > + { > + MEMMODEL_RELAXED = 0, > + MEMMODEL_CONSUME = 1, > + MEMMODEL_ACQUIRE = 2, > + MEMMODEL_RELEASE = 3, > + MEMMODEL_ACQ_REL = 4, > + MEMMODEL_SEQ_CST = 5, > + MEMMODEL_LAST = 6 > + }; This isn't a very machine mode sort of define. I think coretypes.h is a better choice. > + static rtx > + expand_builtin_mem_exchange (enum machine_mode mode, tree exp, rtx target) Some names include "sync" and some don't? > + DEF_SYNC_BUILTIN (BUILT_IN_MEM_EXCHANGE_N, > + "__sync_mem_exchange", > + BT_FN_VOID_VAR, ATTR_NOTHROW_LEAF_LIST) Similarly... > + (define_expand "sync_mem_exchange" > + [(set (match_operand:SWI 0 "register_operand" "=") > + (unspec_volatile:SWI > + [(match_operand:SWI 1 "memory_operand" "+m")] UNSPECV_MEM_XCHG)) > +(set (match_dup 1) > + (match_operand:SWI 2 "register_operand" "0")) > +(match_operand:SI 3 "const_int_operand" "n")] > + "" > + { > + /* lock_test_and_set is only an acquire barrier. If a stronger barrier is > + required, issue a release barrier before the insn. */ > + if (INTVAL (operands[3]) == MEMMODEL_ACQ_REL || > + INTVAL (operands[3]) == MEMMODEL_SEQ_CST) > + emit_insn (gen_memory_barrier ()); > + emit_insn (gen_sync_lock_test_and_set (operands[0], > +operands[1], > +operands[2])); > + DONE; The xchg instruction is a full barrier; no need for anything extra here. Indeed, you needn't define UNSPECV_MEM_XCHG either. This could be as simple as (define_expand "sync_mem_exchange" [(match_operand:SWI 0 "register_operand" "") ;; output (match_operand:SWI 1 "memory_operand" "");; memory (match_operand:SWI 2 "register_operand" "") ;; input (match_operand:SI 3 "const_int_operand" "")];; memory model "" { /* On i386 the xchg instruction is a full barrier. Thus we can completely ignore the memory model operand. */ emit_insn (gen_sync_lock_test_and_set (operands[0], operands[1], operands[2])); DONE; }) r~
Re: __sync_swap* with acq/rel/full memory barrier semantics
On 06/17/2011 02:12 PM, Andrew MacLeod wrote: > Do we apply this to mainline? or cxx-mem-model and then bring it all > over later when they are all done and "perfected" ? Let's put it over in cxx-mem-model at least until we settle on the interface at least. r~
Re: Ping: The TI C6X port
On 06/14/2011 03:40 AM, Bernd Schmidt wrote: >> Allow alternatives in attr "predicable": >> http://gcc.gnu.org/ml/gcc-patches/2011-06/msg00094.html Ok. r~
Re: Improve jump threading #5 of N
On Wed, Jun 15, 2011 at 9:26 PM, Jeff Law wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > > > So as I've mentioned previously, I've been working on a relatively small > change to the jump threading code which would allow it to duplicate a > join block when doing so allows us to thread through a successor of the > join block. This is expected to be the last extension to the existing > jump threading code. > > This was mainly done to improve our ability to eliminate unexecutable > paths through the CFG which helps avoid false positives with certain > warnings. It also has the nice property that it eliminates conditionals > and often results in further optimization of nearby code. > > To help evaluate the code generation improvements of this change I built > gcc-4.6 (checking enabled) using a compiler with and without this > improvement. I then used the 4.6 cc1s to compile a bunch of .i files > under the watchful eye of valgrind. > > without patch with patch > Total cbranches 231072754220 229626578262 > Total ibranches: 7687404775 7686994201 > > > cbranches shows the number of dynamically executed conditional branches. > As you can see, with the patch we eliminated about .625% of the runtime > conditional branches. Not bad at all. We eliminated a trivial number > of indirect branches. In all we eliminated 1446595532 runtime branches. > > without patch with patch > Total instructions: 1254106133886 1247718004946 > > > I was expecting a reduction in the total number of instructions > executed, but was quite surprised at the actual data. We end up > eliminating 6388128940 dynamic instructions --- which means that for > every dynamic branch eliminated, on average we were able to eliminate an > additional 3.4 dynamic instructions -- that's a huge secondary effect. > Clearly improving jump threading in this way is allowing the rest of the > optimizers to do a better job. > > Anyway, attached is the patch. Again, the concept is pretty simple, > when we have a join block which can not be threaded, we peek at the > successors of the join block and see if one or more of them can be threaded. > > If so, we make a duplicate of the join block, wire the incoming edge we > were originally trying to thread to reach the duplicate rather than the > original join block. We then wire the outgoing edge from the duplicate > to the final jump thread target. > > So if given a CFG like this (from a routine in cfgexpand): > > A > / \ > B C > | / \ > | D E > | | / \ > | | F G > \| | > \| > H > / \ > I J > / \ > L M > | / \ > | N O > | | / \ > | | P Q > \| | > \| > R > > > As it turns out some blocks have the same condition (A,I), (C,M), (E,O). > But because of the merge block H, no threading is possible. What we > want to do is make 3 copies of H, each reachable from one predecessor of > the original H. That exposes the jump threading opportunities B->L, > D->N and F->P. The final CFG looks something like this: > > A > / \ > BH'L C > | / \ > |DH'N E > | | / \ > | |FH'P G > \| | > \| > R > > > > Where each H' also has an edge to J from the original CFG, but which is > hard to show here... Note that I, M, O & Q all disappear and each > dynamic path through the cfg is shortened, even though we had to > duplicate H multiple times. > > Bootstrapped and regression tested on x86_64-unknown-linux-gnu. > > OK for mainline? > This caused: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49465 -- H.J.
[PATCH] backport r175089/r175108 to gcc-4_5-branch
Since the common config/mh-darwin file doesn't exist on gcc-4_5-branch, the following patch creates a config/mh-x86-darwin to allow r175089 and r175108 to be effectively backported. This change is worthwhile to provide darwin11 users access to dragonegg (since dragonegg doesn't build on gcc 4.6.x yet). Bootstrap and regression tested on x86_64-apple-darwin11. Okay for gcc-4_5-branch? Jack 2011-06-18 Jack Howarth PR target/49461 * configure.ac: Use mh-x86-darwin. * configure: Regenerate. * config/mh-x86-darwin: Add file and pass -no_pie on BOOT_LDFLAGS for darwin11. Index: configure.ac === --- configure.ac(revision 175182) +++ configure.ac(working copy) @@ -1135,6 +1135,9 @@ case "${host}" in tentative_cc="/usr/cygnus/progressive/bin/gcc" host_makefile_frag="config/mh-lynxrs6k" ;; + i[[3456789]]86-*-darwin* | x86_64-*-darwin*) +host_makefile_frag="config/mh-x86-darwin" +;; powerpc-*-darwin*) host_makefile_frag="config/mh-ppc-darwin" ;; --- /dev/null 2011-06-18 11:57:42.0 -0400 +++ config/mh-x86-darwin2011-06-18 11:52:12.0 -0400 @@ -0,0 +1,2 @@ +# Ensure we don't try and use -pie, as it is incompatible with pch. +BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`