https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70134
Bug ID: 70134 Summary: combine misses jump optimization on powerpc64le Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: amodra at gmail dot com Target Milestone: --- I'm not sure this is really a combine bug, but I noticed that for x86_64 and gfortran.dg/pr46755.f, combine is able to convert (insn 62 34 35 9 (set (reg/v:SI 94 [ qdw ]) (const_int 0 [0])) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 -1 (nil)) (insn 35 62 36 9 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:SI 94 [ qdw ]) (const_int 0 [0]))) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 3 {*cmpsi_ccno_1} (nil)) (jump_insn 36 35 37 9 (set (pc) (if_then_else (eq (reg:CCZ 17 flags) (const_int 0 [0])) (label_ref 30) (pc))) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 635 {*jcc_1} (expr_list:REG_DEAD (reg:CCZ 17 flags) (int_list:REG_BR_PROB 5000 (nil))) -> 30) into an unconditional jump which then allows pruning of the fall-through block and a whole lot more optimization. For powerpc64le, the corresponding sequence is split over two blocks (thus not really a combine bug I guess). (insn 76 34 38 2 (set (reg/v:DI 162 [ qdw ]) (const_int 0 [0])) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 -1 (nil)) (insn 38 76 11 2 (set (reg:CC 178) (compare:CC (reg/v:DI 162 [ qdw ]) (const_int 0 [0]))) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 720 {*cmpdi_signed} (expr_list:REG_DEAD (reg/v:DI 162 [ qdw ]) (nil))) .... (jump_insn 39 36 40 9 (set (pc) (if_then_else (eq (reg:CC 178) (const_int 0 [0])) (label_ref 32) (pc))) /src/gcc.git/gcc/testsuite/gfortran.dg/pr46755.f:16 755 {*rs6000.md:11588} (int_list:REG_BR_PROB 5000 (nil)) -> 32) No pass seems to recognize that reg:CC 178 has a known value (from comparing zero with zero). If combine had this information it could convert insn 39 to an unconditional jump, the fallthrough block would be deleted and insn 38 and 76 seen to be dead.