https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94613
Bug ID: 94613 Summary: combine: Wrong code due to splitting a simplified IF_THEN_ELSE Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: critical Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: krebbel at gcc dot gnu.org Target Milestone: --- Created attachment 48284 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48284&action=edit autoreduced testcase When compiling the attached testcase for IBM Z GCC optimizes an OR operation away during combine leading to wrong code being generated: cc1plus -O3 -march=z14 t.ii -quiet -o t.s try_combine is invoked for the following 3 insns: i1: 28: r111 = r110 | r158 i2: 31: r115 = r111 - r94 i3: 36: r122 = (r110 == 0 ? r115 : r177) i3 becomes the following after inserting i1 and i2 36: r122 = (r110 == 0 ? r110 | r158 - r94 : r177) simplification omits ORing r110 since it is 0 anyway: 36: r122 = (r110 == 0 ? r158 - r94 : r177) after not being able to recognize the insn it gets split into parts again: 28: deleted 31: r115 = r158 - r94 36: r122 = (r110 == 0 ? r115 : r177)