For the reasons explained in PR77536, niter_for_unrolled_loop assumes 5
iterations in the absence of profiling information, although it doesn't
increase beyond the estimate for the original loop. This left a hole in
which the new estimate could be less than the old one but still greater
than the limit imposed by CEIL (nb_iterations_upper_bound, unroll factor).
2017-05-04 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* tree-ssa-loop-manip.c (niter_for_unrolled_loop): Add commentary
to explain the use of truncating division. Cap the number of
iterations to the maximum given by nb_iterations_upper_bound,
if defined.
gcc/testsuite/
* gcc.dg/vect/vect-profile-1.c: New test.
From-SVN: r247591
This patch adds support for purecode to ARMv8-M Baseline, in addition to
the existing support for ARMv7-M and ARMv8-M Mainline.
2017-05-04 Prakhar Bahuguna <prakhar.bahuguna@arm.com>
Andre Simoes Dias Vieira <andre.simoesdiasvieira@arm.com>
gcc/
* config/arm/arm.md (movsi): Change TARGET_32BIT to TARGET_HAVE_MOVT.
(movt splitter): Likewise.
* config/arm/arm.c (arm_option_check_internal): Change arm_arch_thumb2
to TARGET_HAVE_MOVT, and merge with -mslow-flash-data check.
(const_ok_for_arm): Change else to else if (TARGET_THUMB2) and add else
block for Thumb-1 with MOVT.
(thumb2_legitimate_address_p): Move code block ...
(can_avoid_literal_pool_for_label_p): ... into this new function.
(thumb1_legitimate_address_p): Add check for TARGET_HAVE_MOVT and
literal pool.
(thumb_legitimate_constant_p): Add conditional on TARGET_HAVE_MOVT
* doc/invoke.texi (-mpure-code): Change "ARMv7-M targets" for
"M-profile targets with the MOVT instruction".
gcc/testsuite/
* gcc.target/arm/pure-code/pure-code.exp: Add conditional for
check_effective_target_arm_thumb1_movt_ok.
Co-Authored-By: Andre Vieira <andre.simoesdiasvieira@arm.com>
From-SVN: r247585
The GCC documentation in section 6.60.8 ARM Floating Point Status and
Control Intrinsics states that the FPSCR register can be read and
written to using the intrinsics __builtin_arm_get_fpscr and
__builtin_arm_set_fpscr. However, these are misnamed within GCC itself
and these intrinsic names are not recognised.
This patch corrects the intrinsic names to match the documentation, and
adds tests to verify these intrinsics generate the correct
instructions.
2017-05-04 Prakhar Bahuguna <prakhar.bahuguna@arm.com>
gcc/
* gcc/config/arm/arm-builtins.c (arm_init_builtins): Rename
__builtin_arm_ldfscr to __builtin_arm_get_fpscr, and rename
__builtin_arm_stfscr to __builtin_arm_set_fpscr.
gcc/testsuite/
* gcc.target/arm/fpscr.c: New file.
From-SVN: r247584
* brig-builtins.def: Added a builtin for class_f64.
* builtin-types.def: Added a builtin type needed by class_f64.
* brigfrontend/brig-code-entry-handler.cc
(brig_code_entry_handler::build_address_operand): Fix a bug
with reg+offset addressing on 32b segments. In large mode,
the offset is treated as 32bits unless it's global, readonly or
kernarg address space.
* rt/workitems.c: Removed a leftover comment.
* rt/arithmetic.c (__hsail_class_f32, __hsail_class_f64): Fix the
check for signaling/non-signalling NaN. Add class_f64 default
implementation.
From-SVN: r247576
2017-05-03 Martin Jambor <mjambor@suse.cz>
* ipa-prop.h (ipa_edge_args): Make a class. Mark with for_user GTY
tag. Added a default constructor and a destructor.
(ipa_edge_args_sum_t): New class;
(ipa_edge_args_sum): Declare.
(ipa_edge_args_vector): Remove declaration.
(IPA_EDGE_REF): Use ipa_edge_args_sum.
(ipa_free_edge_args_substructures): Remove declaration.
(ipa_check_create_edge_args): Use ipa_edge_args_sum.
(ipa_edge_args_info_available_for_edge_p): Likewise.
* ipa-prop.c (ipa_edge_args_vector): Removed.
(edge_removal_hook_holder): Likewise.
(edge_duplication_hook_holder): Likewise.
(ipa_edge_args_sum): New variable.
(ipa_propagate_indirect_call_infos): Test ipa_edge_args_sum instead of
ipa_edge_args_vector.
(ipa_free_edge_args_substructures): Likewise.
(ipa_free_all_edge_args): Free ipa_edge_args_sum instead of
ipa_edge_args_vector.
(ipa_edge_removal_hook): Turned into method
ipa_edge_args_sum_t::remove.
(ipa_edge_duplication_hook): Turned into method
ipa_edge_args_sum_t::duplicate.
(ipa_register_cgraph_hooks): Create ipa_edge_args_sum instead of
registering edge hooks.
(ipa_unregister_cgraph_hooks): Do not unregister edge hooks.
* ipa-inline-analysis.c (estimate_function_body_sizes): Test
ipa_edge_args_sum instead of ipa_edge_args_vector.
* ipa-profile.c (ipa_profile): Likewise.
From-SVN: r247558
PR tree-optimization/78496
* tree-vrp.c (simplify_cond_using_ranges_1): Renamed
from simplify_cond_using_ranges. Split off code to walk
backwards through casts into ...
(simplify_cond_using_ranges_2): New function.
(simplify_stmt_using_ranges): Call simplify_cond_using_ranges_1.
(execute_vrp): After identifying jump threads, call
simplify_cond_using_ranges_2.
PR tree-optimization/78496
* gcc.dg/tree-ssa/ssa-thread-15.c: New test.
From-SVN: r247556
The existing fix-it printer can lead to difficult-to-read output
when fix-it hints are near each other. For example, in a recent
patch to add fix-it hints to the C++ frontend's -Wold-style-cast,
e.g. for:
foo *f = (foo *)ptr->field;
^~~~~
the fix-it hints:
replace the open paren with "const_cast<"
replace the close paren with "> ("
insert ")" after the "ptr->field"
would be printed in this odd-looking way:
foo *f = (foo *)ptr->field;
^~~~~
-
const_cast<
-
> ( )
class rich_location consolidates adjacent fix-it hints, which helps
somewhat, but the underlying problem is that the existing printer
simply walks through the list of hints printing them, starting newlines
as necessary.
This patch reimplements fix-it printing by introducing a planning
stage: a new class line_corrections "plans" how to print the
fix-it hints affecting a line, generating a vec of "correction"
instances. Hints that are sufficiently close to each other are
consolidated at this stage.
This leads to the much more reasonable output for the above case:
foo *f = (foo *)ptr->field;
^~~~~
-----------------
const_cast<foo *> (ptr->field);
where the 3 hints are consolidated into one "correction" at printing.
gcc/ChangeLog:
* diagnostic-show-locus.c (struct column_range): New struct.
(get_affected_columns): New function.
(get_printed_columns): New function.
(struct correction): New struct.
(correction::ensure_capacity): New function.
(correction::ensure_terminated): New function.
(struct line_corrections): New struct.
(line_corrections::~line_corrections): New dtor.
(line_corrections::add_hint): New function.
(layout::print_trailing_fixits): Reimplement in terms of the new
classes.
(selftest::test_overlapped_fixit_printing): New function.
(selftest::diagnostic_show_locus_c_tests): Call it.
From-SVN: r247548
Canonicalize canonical type hashing
gcc/
* tree.h (type_hash_canon_hash): Declare.
* tree.c (type_hash_list, attribute_hash_list): Move into
type_hash_canon_hash.
(build_type_attribute_qual_variant): Break out hash code calc into
type_hash_canon_hash.
(type_hash_canon_hash): New. Generic type hash computation.
(build_range_type_1, build_array_type_1, build_function_type)
build_method_type_directly, build_offset_type, build_complex_type,
make_vector_type): Call it.
gcc/c-family/
* c-common.c (complete_array_type): Use type_hash_canon.
(--This line, and those below, will be ignored--
M gcc/tree.c
M gcc/tree.h
M gcc/c-family/ChangeLog
M gcc/c-family/c-common.c
M gcc/ChangeLog
From-SVN: r247546
2017-05-03 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
When all DRs have unknown misaligned do not always peel
when there is a store but apply the same costing model as if
there were only loads.
* gcc.dg/vect/costmodel/x86_64/costmodel-alignpeel.c: New testcase.
From-SVN: r247544
2017-05-03 Thomas Preud'homme <thomas.preudhomme@arm.com>
gcc/
* config/arm/iterators.md (CCSI): New mode iterator.
(arch): New mode attribute.
* config/arm/sync.md (atomic_compare_and_swap<mode>_1): Rename into ...
(atomic_compare_and_swap<CCSI:arch><NARROW:mode>_1): This and ...
(atomic_compare_and_swap<CCSI:arch><SIDI:mode>_1): This. Use CCSI
code iterator for success result mode.
* config/arm/arm.c (arm_expand_compare_and_swap): Adapt code to use
the corresponding new insn generators.
From-SVN: r247542
PR tree-optimization/79472
* tree-switch-conversion.c (struct switch_conv_info): Add
contiguous_range and default_case_nonstandard fields.
(collect_switch_conv_info): Compute contiguous_range and
default_case_nonstandard fields, don't clear final_bb if
contiguous_range and only the default case doesn't have the required
structure.
(check_all_empty_except_final): Set default_case_nonstandard instead
of failing if contiguous_range and the default case doesn't have empty
block.
(check_final_bb): Add SWTCH argument, don't fail if contiguous_range
and only the default case doesn't have the required constants. Skip
virtual phis.
(gather_default_values): Skip virtual phis. Allow non-NULL CASE_LOW
if default_case_nonstandard.
(build_constructors): Build constant 1 just once. Assert that default
values aren't inserted in between cases if contiguous_range. Skip
virtual phis.
(build_arrays): Skip virtual phis.
(prune_bbs): Add DEFAULT_BB argument, don't remove that bb.
(fix_phi_nodes): Don't add e2f phi arg if default_case_nonstandard.
Handle virtual phis.
(gen_inbound_check): Handle default_case_nonstandard case.
(process_switch): Adjust check_final_bb caller. Call
gather_default_values with the first non-default case instead of
default case if default_case_nonstandard.
* gcc.dg/tree-ssa/vrp40.c: Add -fno-tree-switch-conversion to dg-options.
* gcc.dg/tree-ssa/vrp113.c: New test.
* gcc.dg/tree-ssa/cswtch-3.c: New test.
* gcc.dg/tree-ssa/cswtch-4.c: New test.
* gcc.dg/tree-ssa/cswtch-5.c: New test.
From-SVN: r247538
Previously fix-it hints couldn't contain newlines. This is
due to the need to print something user-readable for them
within diagnostic-show-locus, and for handling them within
edit-context for printing diffs and regenerating content.
This patch enables limited support for fix-it hints with newlines,
for suggesting adding new lines.
Such a fix-it hint must have exactly one newline character, at the
end of the content. It must be an insertion at the beginning of
a line (so that e.g. fix-its that split a pre-existing line are
still rejected).
They are printed by diagnostic-show-locus with a '+' in the
left-hand margin, like this:
test.c:42:4: note: suggest adding 'break;' here
+ break;
case 'b':
^~~~~~~~~
and the printer injects "spans" if the insertion location is not
near the primary range of the diagnostic e.g.:
test.c:4:2: note: unrecognized 'putchar'; suggest including '<stdio.h>'
test.c:1:1:
+#include <stdio.h>
test.c:4:2:
putchar (ch);
^~~~~~~
gcc/ChangeLog:
* diagnostic-show-locus.c
(layout::should_print_annotation_line_p): Make private.
(layout::print_annotation_line): Make private.
(layout::annotation_line_showed_range_p): Make private.
(layout::show_ruler): Make private.
(layout::print_source_line): Make private. Pass in line and
line_width, rather than calling location_get_source_line. Drop
returned value.
(layout::print_leading_fixits): New method.
(layout::print_any_fixits): Rename to...
(layout::print_trailing_fixits): ...this, and make private.
Don't print newline fixits.
(diagnostic_show_locus): Move logic for printing one row into...
(layout::print_line): ...this new function. Move the
location_get_source_line call and error-handling from
print_source_line to here. Call print_leading_fixits, and rename
print_any_fixits to print_trailing_fixits.
(selftest::test_fixit_insert_containing_newline): Update now that
newlines are partially supported.
(selftest::test_fixit_insert_containing_newline_2): New test.
(selftest::test_fixit_replace_containing_newline): Update comments.
(selftest::diagnostic_show_locus_c_tests): Call the new test.
* edit-context.c (class added_line): New class.
(class edited_line): Describe newline handling in comment.
(edited_line::actually_edited_p): New method.
(edited_line::print_content): Delete redundant decl.
(edited_line::m_predecessors): New field.
(edited_file::print_content): Call edited_line::print_content.
(edited_file::print_diff): Update to support newlines.
(edited_file::print_diff_hunk): Likewise.
(edited_file::print_run_of_changed_lines): New function.
(edited_file::print_diff_line): Convert to...
(print_diff_line): ...this.
(edited_file::get_effective_line_count): New function.
(edited_line::edited_line): Initialize new field m_predecessors.
(edited_line::~edited_line): Clean up m_predecessors.
(edited_line::apply_fixit): Handle newlines.
(edited_line::get_effective_line_count): New function.
(edited_line::print_content): New function.
(edited_line::print_diff_lines): New function.
(selftest::test_applying_fixits_insert_containing_newline): New
test.
(selftest::test_applying_fixits_replace_containing_newline): New
test.
(selftest::insert_line): New function.
(selftest::test_applying_fixits_multiple_lines): Add example of
inserting a line.
(selftest::edit_context_c_tests): Call the new tests.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic-test-show-locus-bw.c
(test_fixit_insert_newline): New function.
* gcc.dg/plugin/diagnostic-test-show-locus-color.c
(test_fixit_insert_newline): New function.
* gcc.dg/plugin/diagnostic-test-show-locus-generate-patch.c
(test_fixit_insert_newline): New function.
* gcc.dg/plugin/diagnostic-test-show-locus-parseable-fixits.c
(test_fixit_insert_newline): New function.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(test_show_locus): Handle test_fixit_insert_newline.
libcpp/ChangeLog:
* include/line-map.h (class rich_location): Update description of
newline handling.
(class fixit_hint): Likewise.
(fixit_hint::ends_with_newline_p): New decl.
* line-map.c (rich_location::maybe_add_fixit): Support newlines
in fix-it hints that are insertions of single lines at the start
of a line. Don't consolidate into such fix-it hints.
(fixit_hint::ends_with_newline_p): New method.
From-SVN: r247522