https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70710
Bug ID: 70710 Summary: [5/6/7 Regression] Compile time hog w/ -O -g -fpeel-loops Product: gcc Version: 5.3.0 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- gcc 5.3.0 and later takes infinite time to compile the following reduced snippet w/ -O[123] (or -Ofast) -g -fpeel-loops on x86_64-pc-linux-gnu: long int mh = 0; int du = 0; void vg (void) { int qe; char u1; for (qe = 0; qe < 16; ++qe) { mh &= du; du &= mh; u1 = du; } mh = 0; } Several top calls brought up by perf: 48.52% cc1 [.] nonzero_bits1 17.45% cc1 [.] cached_nonzero_bits 14.68% cc1 [.] reg_nonzero_bits_for_combine 1.29% cc1 [.] bitmap_bit_p 1.12% cc1 [.] target_default_pointer_address_modes_p 0.85% cc1 [.] val_signbit_known_set_p 0.27% cc1 [.] rtx_equal_p 0.26% cc1 [.] commutative_operand_precedence 0.22% cc1 [.] simplify_binary_operation_1 0.18% cc1 [.] simplify_replace_fn_rtx 0.15% cc1 [.] volatile_insn_p 0.12% cc1 [.] simplify_binary_operation 0.12% cc1 [.] avoid_constant_pool_reference 0.11% cc1 [.] ggc_internal_alloc 0.10% cc1 [.] simplify_const_binary_operation 0.07% cc1 [.] simplify_associative_operation 0.06% cc1 [.] validate_subreg 0.05% cc1 [.] swap_commutative_operands_p 0.05% cc1 [.] copy_rtx 0.04% cc1 [.] simplify_gen_binary 0.02% cc1 [.] simplify_subreg The original code had stuck for about 14 hours in compilation before I noticed that.