https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82597
Uroš Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-10-18 Ever confirmed|0 |1 --- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> --- Postreload compare elimination pass creates invalid instruction when merging: (insn 55 8 49 2 (set (reg/v:SI 0 ax [orig:92 k ] [92]) (plus:SI (reg:SI 2 cx [orig:88 _2 ] [88]) (const_int 1 [0x1]))) "pr82597.c":6 213 {*leasi} (nil)) and: (insn 21 20 22 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg/v:SI 0 ax [orig:92 k ] [92]) (const_int 0 [0]))) "pr82597.c":6 3 {*cmpsi_ccno_1} (nil)) The merged instruction: (insn 56 8 10 2 (parallel [ (set (reg:CCZ 17 flags) (compare:CCZ (plus:SI (reg:SI 2 cx [orig:88 _3 ] [88]) (const_int 1 [0x1])) (const_int 0 [0]))) (set (reg/v:SI 0 ax [orig:91 k ] [91]) (plus:SI (reg:SI 2 cx [orig:88 _3 ] [88]) (const_int 1 [0x1]))) ]) "pr82597.c":6 -1 (nil)) does not satisfy constraints: (define_insn "*add<mode>_2" [(set (reg FLAGS_REG) (compare (plus:SWI (match_operand:SWI 1 "nonimmediate_operand" "%0,0,<r>") (match_operand:SWI 2 "<general_operand>" "<g>,<r><i>,0")) (const_int 0))) (set (match_operand:SWI 0 "nonimmediate_operand" "=<r>,<r>m,<r>") (plus:SWI (match_dup 1) (match_dup 2)))] since input and output register has to be matched. cmpelim pass should check if merged instruction satisfies constraints. (Must be some recent development that introduced the failure. IIRC, cmpelim pass substitutes FLAGS_REG clobber in the pattern with the follow-up comparison. LEA has no clobber, so that should prevent merging). Confirmed as a rtl-optimization problem.