https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69467
Bug ID: 69467 Summary: [6 Regression] Pattern X * C1 CMP 0 to X CMP 0 causes performance drop on 32-bit x86. Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: ysrumyan at gmail dot com Target Milestone: --- This is caused by the same revision as 67438 http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=225248 The issue can be reproduced with attached test-case. After such transformation applied to loop upper bound: for ( count = ((*(ptr)) & 0xf) * 2; count > 0; count--, addr++ ) two redundant instructions are generated: after before movl 48(%esp), %ebx movl 48(%esp), %ecx movzbl (%ebx), %eax movzbl (%ecx), %edx andl $15, %eax andl $15, %edx movzbl %al, %ecx addl %edx, %edx addl %ecx, %ecx testb %al, %al je .L12 je .L12 This can be essential if loop has low trip count.