PR tree-optimization/64183
* c-gimplify.c (c_gimplify_expr): Don't convert the RHS of a
shift-expression if it is integer_type_node. Use types_compatible_p.
* gcc.dg/tree-ssa/pr64183.c: New test.
From-SVN: r218447
PR sanitizer/64170
* sanopt.c (maybe_optimize_asan_check_ifn): If base_checks is
non-NULL, call maybe_get_dominating_check on it even if g is
non-NULL.
* gcc.dg/asan/pr64170.c: New test.
From-SVN: r218440
2014-12-05 Andrew Pinski <apinski@cavium.com>
* config/aarch64/aarch64-simd-builtins.def (bswap): Use CF2 rather
than CF10 so 2 is appended on the code.
* config/aarch64/aarch64-simd.md (bswap<mode>): Rename to ...
(bswap<mode>2): This so it matches for the optabs.
From-SVN: r218435
2014-12-05 Martin Jambor <mjambor@suse.cz>
PR ipa/64192
* ipa-prop.c (ipa_compute_jump_functions_for_edge): Convert alignment
from bits to bytes after checking they are byte-aligned.
From-SVN: r218433
2014-12-05 Olivier Hainque <hainque@adacore.com>
* dwarf2cfi.c (init_one_dwarf_reg_size): New helper, processing
one particular reg for expand_builtin_init_dwarf_reg_sizes.
(expand_builtin_init_dwarf_reg_sizes): Rework to use helper and
account for dwarf register spans.
From-SVN: r218428
gcc/fortran/ChangeLog:
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
* error.c (gfc_diagnostic_build_locus_prefix): Use
diagnostic_expand_location.
gcc/ChangeLog:
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
* diagnostic.h (diagnostic_expand_location): New inline function.
* diagnostic.c (diagnostic_build_prefix): Use it.
(diagnostic_show_locus): Likewise.
From-SVN: r218409
libcpp/ChangeLog:
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
* line-map.c (linemap_position_for_loc_and_offset): Add new
linemap_assert_fails.
gcc/fortran/ChangeLog:
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
* scanner.c (gfc_next_char_literal): Use gfc_warning_now.
(load_file): Use the line length as the column hint for
linemap_line_start. Reserve a location for the highest column of
the line.
From-SVN: r218407
gcc/ChangeLog:
2014-12-04 Manuel López-Ibáñez <manu@gcc.gnu.org>
* diagnostic.c (diagnostic_color_init): New.
* diagnostic.h: Declare.
* gcc.c (driver::global_initializations): Use it.
(driver_handle_option): Handle -fdiagnostics-color_.
* toplev.c: Do not include diagnostic-color.h.
(process_options): Do not initialize color diagnostics here.
* common.opt (fdiagnostics-color=): Add Driver.
* opts-global.c (init_options_once): Initialize color here.
* opts.c (common_handle_option): Use diagnostics_color_init.
* diagnostic-color.h: Fix comment.
From-SVN: r218406
gcc/ChangeLog:
PR jit/63854
* tree-pretty-print.c: Eliminate include of <new>.
(buffer): Convert this variable from a pretty_printer to a
pretty_printer *.
(initialized): Eliminate this variable in favor of the NULL-ness
of "buffer".
(print_generic_decl): Update for "buffer" becoming a pointer.
(print_generic_stmt): Likewise.
(print_generic_stmt_indented): Likewise.
(print_generic_expr): Likewise.
(maybe_init_pretty_print): Likewise, allocating "buffer" on the
heap and using its non-NULL-ness to ensure idempotency.
From-SVN: r218404
gcc/ChangeLog:
PR jit/63854
* ipa-prop.c (ipa_register_cgraph_hooks): Guard insertion of
ipa_add_new_function on function_insertion_hook_holder being
non-NULL.
* ipa-reference.c (ipa_reference_c_finalize): Remove
node_removal_hook_holder and node_duplication_hook_holder if
they've been added to symtab.
* toplev.c (toplev::finalize): Call ipa_reference_c_finalize
before cgraph_c_finalize so that the former can access "symtab".
From-SVN: r218403
Normally, with -fPIE/-fpie, GCC accesses globals that are extern to the
module using the GOT. This is two instructions, one to get the address
of the global from the GOT and the other to get the value. If it turns
out that the global gets defined in the executable at link-time, it still
needs to go through the GOT as it is too late then to generate a direct
access.
Examples:
foo.cc
------
int a_glob;
int main () {
return a_glob; // defined in this file
}
With -O2 -fpie -pie, the generated code directly accesses the global via
PC-relative insn:
5e0 <main>:
mov 0x165a(%rip),%eax # 1c40 <a_glob>
foo.cc
------
extern int a_glob;
int main () {
return a_glob; // defined in this file
}
With -O2 -fpie -pie, the generated code accesses global via GOT using
two memory loads:
6f0 <main>:
mov 0x1609(%rip),%rax # 1d00 <_DYNAMIC+0x230>
mov (%rax),%eax
This is true even if in the latter case the global was defined in the
executable through a different file.
Some experiments on google benchmarks shows that the extra memory loads
affects performance by 1% to 5%.
Solution - Copy Relocations:
When the linker supports copy relocations, GCC can always assume that
the global will be defined in the executable. For globals that are truly
extern (come from shared objects), the linker will create copy relocations
and have them defined in the executable. Result is that no global access
needs to go through the GOT and hence improves performance.
This optimization only applies to undefined, non-weak global data.
Undefined, weak global data access still must go through the GOT.
This patch checks if linker supports PIE with copy reloc, which is
enabled in gold and bfd linker in bininutils 2.25, at configure time
and enables this optimization if the linker support is available.
gcc/
* configure.ac (HAVE_LD_PIE_COPYRELOC): Defined to 1 if
Linux/x86-64 linker supports PIE with copy reloc.
* config.in: Regenerated.
* configure: Likewise.
* config/i386/i386.c (legitimate_pic_address_disp_p): Allow
pc-relative address for undefined, non-weak, non-function
symbol reference in 64-bit PIE if linker supports PIE with
copy reloc.
* doc/sourcebuild.texi: Document pie_copyreloc target.
gcc/testsuite/
* gcc.target/i386/pie-copyrelocs-1.c: New test.
* gcc.target/i386/pie-copyrelocs-2.c: Likewise.
* gcc.target/i386/pie-copyrelocs-3.c: Likewise.
* gcc.target/i386/pie-copyrelocs-4.c: Likewise.
* lib/target-supports.exp (check_effective_target_pie_copyreloc):
New procedure.
Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com>
From-SVN: r218397
PR middle-end/56917
* fold-const.c (fold_unary_loc): Perform the negation in A's type
when transforming ~ (A - 1) or ~ (A + -1) to -A.
* c-c++-common/ubsan/pr56917.c: New test.
From-SVN: r218395
2014-12-04 Thomas Preud'homme <thomas.preudhomme@arm.com>
contrib/
* check_GNU_style.sh: Warn for incorrect number of spaces in function
call only if 0 or 2+ spaces found.
From-SVN: r218382
2014-12-04 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_alignment): New type.
(ipa_jump_func): New field alignment.
(ipcp_transformation_summary) New type.
(ipcp_grow_transformations_if_necessary): Declare.
(ipa_node_agg_replacements): Removed.
(ipcp_transformations): Declare.
(ipcp_get_transformation_summary): New function.
(ipa_get_agg_replacements_for_node): Use it.
* ipa-cp.c (ipcp_param_lattices): New field alignment.
(print_all_lattices): Also print alignment.
(alignment_bottom_p): New function.
(set_alignment_to_bottom): Likewise.
(set_all_contains_variable): Also set alignment to bottom.
(initialize_node_lattices): Likewise.
(propagate_alignment_accross_jump_function): New function.
(propagate_constants_accross_call): Call it.
(ipcp_store_alignment_results): New function.
(ipcp_driver): Call it.
* ipa-prop.c (ipa_node_agg_replacements): Removed.
(ipcp_transformations): New.
(ipa_print_node_jump_functions_for_edge): Also print alignment.
(ipa_set_jf_unknown): New function.
(detect_type_change_from_memory_writes): Use ipa_set_jf_unknown.
(ipa_compute_jump_functions_for_edge): Also calculate alignment.
(update_jump_functions_after_inlining): Use ipa_set_jf_unknown.
(ipcp_grow_transformations_if_necessary): New function.
(ipa_set_node_agg_value_chain): Use ipcp_transformations.
(ipa_node_removal_hook): Likewise.
(ipa_node_duplication_hook): Also duplicate alignment results.
(ipa_write_jump_function): Also stream alignments.
(ipa_read_jump_function): Use ipa_set_jf_unknown, also stream
alignments.
(write_agg_replacement_chain): Renamed to
write_ipcp_transformation_info, also stream alignments.
(read_agg_replacement_chain): Renamed to
read_ipcp_transformation_info, also stream alignments.
(ipa_prop_write_all_agg_replacement): Renamed to
ipcp_write_transformation_summaries. Stream always.
(ipa_prop_read_all_agg_replacement): Renamed to
ipcp_read_transformation_summaries.
(ipcp_update_alignments): New function.
(ipcp_transform_function): Call it, free also alignments.
testsuite/
* gcc.dg/ipa/propalign-1.c: New test.
* gcc.dg/ipa/propalign-2.c: Likewise.
From-SVN: r218369