[PATCH] Remove quite obvious dead assignments.

Jeff Law law@redhat.com
Wed Jun 26 20:25:00 GMT 2019


On 6/26/19 4:57 AM, Martin Liška wrote:
> Hi.
> 
> I've spent some with clang-static-analyzer and I analyzed the warnings reported.
> As always wit analyzers, majority of the issues are false positives, however it caught
> couple of real issues:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90973
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90978
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90976
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90975
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90970
> 
> That said, I'm sending a patch that rapidly shrinks number of Dead assignments.
> I've chosen to remove only these that are quite trivial and that do not span
> among multiple if-else branches.
> 
> I hope the patch will be readable and approved.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests. I'm
> also testing that on ppc64 big endian machine.
> 
> Ready to be installed?
> Thanks,
> Martin
> 
> 
> gcc/ChangeLog:
> 
> 2019-06-26  Martin Liska  <mliska@suse.cz>
> 
> 	* asan.c (asan_emit_allocas_unpoison): Remove obviously
> 	dead assignments.
> 	* bt-load.c (move_btr_def): Likewise.
> 	* builtins.c (expand_builtin_apply_args_1): Likewise.
> 	(expand_builtin_apply): Likewise.
> 	* cfgexpand.c (expand_asm_stmt): Likewise.
> 	(construct_init_block): Likewise.
> 	* cfghooks.c (verify_flow_info): Likewise.
> 	* cfgloopmanip.c (remove_path): Likewise.
> 	* cfgrtl.c (rtl_verify_bb_layout): Likewise.
> 	* cgraph.c (cgraph_node::set_pure_flag): Likewise.
> 	* combine.c (simplify_if_then_else): Likewise.
> 	* config/i386/i386-expand.c (ix86_expand_rounddf_32): Likewise.
> 	* config/i386/i386.c (ix86_setup_incoming_vararg_bounds): Likewise.
> 	(choose_basereg): Likewise.
> 	(ix86_expand_prologue): Likewise.
> 	(ix86_preferred_output_reload_class): Likewise.
> 	* cselib.c (cselib_record_sets): Likewise.
> 	* df-scan.c (df_scan_alloc): Likewise.
> 	* dojump.c (do_jump_by_parts_greater_rtx): Likewise.
> 	* early-remat.c (early_remat::record_equiv_candidates): Likewise.
> 	* emit-rtl.c (try_split): Likewise.
> 	* graphite-scop-detection.c (assign_parameter_index_in_region): Likewise.
> 	* ipa-cp.c (cgraph_edge_brings_all_agg_vals_for_node): Likewise.
> 	* ira-color.c (setup_profitable_hard_regs): Likewise.
> 	* ira.c (rtx_moveable_p): Likewise.
> 	* lra-eliminations.c (eliminate_regs_in_insn): Likewise.
> 	* read-rtl.c (read_subst_mapping): Likewise.
> 	* regrename.c (scan_rtx): Likewise.
> 	* reorg.c (fill_slots_from_thread): Likewise.
> 	* tree-inline.c (tree_function_versioning): Likewise.
> 	* tree-ssa-reassoc.c (optimize_ops_list): Likewise.
> 	* tree-ssa-sink.c (statement_sink_location): Likewise.
> 	* tree-ssa-threadedge.c (thread_across_edge): Likewise.
> 	* tree-vect-loop.c (vect_get_loop_niters): Likewise.
> 	(vect_create_epilog_for_reduction): Likewise.
> 	* tree-vect-stmts.c (vectorizable_call): Likewise.
> 	* tree.c (build_nonstandard_integer_type): Likewise.
> 
> gcc/cp/ChangeLog:
> 
> 2019-06-26  Martin Liska  <mliska@suse.cz>
> 
> 	* class.c (adjust_clone_args): Remove obviously
> 	dead assignments.
> 	(dump_class_hierarchy_r): Likewise.
> 	* decl.c (check_initializer): Likewise.
> 	* parser.c (cp_parser_lambda_expression): Likewise.
> 	* pt.c (unify_bound_ttp_args): Likewise.
> 	(convert_template_argument): Likewise.
> 	* rtti.c (build_headof): Likewise.
> 	* typeck.c (convert_for_initialization): Likewise.
> 
> libgcc/ChangeLog:
> 
> 2019-06-26  Martin Liska  <mliska@suse.cz>
> 
> 	* libgcov-driver-system.c (gcov_exit_open_gcda_file): Remove obviously
> 	dead assignments.
> 	* libgcov-util.c: Likewise.
I think you've already received a bit of feedback here, particularly WRT
emit_library_call vs emit_library_call_value.  I think this is fine for
the trunk once you've addressed the comments that have already been made.

jeff



More information about the Gcc-patches mailing list