https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115004
Bug ID: 115004 Summary: [11/12/13/14/15 Regression] Missed optimization for Dead Code Elimination Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: 652023330028 at smail dot nju.edu.cn Target Milestone: --- Hello, we noticed that the code below can be optimized by Dead Code Elimination, but gcc -O3 missed it. This is a regression from GCC-8.1. https://godbolt.org/z/7e64e56Mq int m; void fn(signed char p1, short p2, signed char p3_1, signed char p3_2, short p4, unsigned char p5) { if( (signed char)((p4 | 0) && (p1 || p2) || p5 || p3_1 && p5) - (signed char)((p4 | 0) && (p1 || p2) || p5 || p3_2 && p5) ) { m=1; } } GCC -O3: fn(signed char, short, signed char, signed char, short, unsigned char): test r8w, r8w je .L1 test dil, dil setne al test si, si setne dl or eax, edx test r9b, r9b jne .L6 .L1: ret .L6: test al, al jne .L1 test r9b, r9b jne .L1 mov DWORD PTR m[rip], 1 ret Expected code (GCC-7.5): fn(signed char, short, signed char, signed char, short, unsigned char): rep ret Thank you very much for your time and effort! We look forward to hearing from you.