public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d @ 2023-11-15 9:42 theodort at inf dot ethz.ch 2023-11-15 11:59 ` [Bug tree-optimization/112542] " rguenth at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: theodort at inf dot ethz.ch @ 2023-11-15 9:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542 Bug ID: 112542 Summary: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: theodort at inf dot ethz.ch Target Milestone: --- https://godbolt.org/z/3vj8x1bPK Given the following code: void foo(void); static short b = -1; static int c, e; static int *f = &c; static char g; static char(a)(char h, int i) { if (!(((i) >= -1) && ((i) <= 0))) { __builtin_unreachable(); } return h || i ? h : h < 0; } static void(d)(unsigned h) { if (!(((h) >= 0) && ((h) <= 4095017279))) { foo(); } } int main() { *f = b == 0; g = a(c, c); d(g); d(4095017279); if (e) b = 0; a(0, b); } gcc-trunk -O3 does not eliminate the call to foo: main: xorl %eax, %eax cmpw $0, b(%rip) sete %al movl %eax, c(%rip) jne .L4 pushq %rax call foo xorl %eax, %eax popq %rdx ret .L4: xorl %eax, %eax ret gcc-13.2.0 -O3 eliminates the call to foo: main: xorl %eax, %eax cmpw $0, b(%rip) sete %al movl %eax, c(%rip) xorl %eax, %eax ret Bisects to r14-4280-gc3c6f30496d ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/112542] [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d 2023-11-15 9:42 [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d theodort at inf dot ethz.ch @ 2023-11-15 11:59 ` rguenth at gcc dot gnu.org 2023-11-15 16:48 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2023-11-15 11:59 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Target Milestone|--- |14.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/112542] [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d 2023-11-15 9:42 [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d theodort at inf dot ethz.ch 2023-11-15 11:59 ` [Bug tree-optimization/112542] " rguenth at gcc dot gnu.org @ 2023-11-15 16:48 ` pinskia at gcc dot gnu.org 2024-03-07 21:02 ` law at gcc dot gnu.org 2024-05-07 7:42 ` [Bug tree-optimization/112542] [14/15 " rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-11-15 16:48 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2023-11-15 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- ``` _7 = (char) c.2_5; ... _26 = _7 == 0; _27 = c.2_5 == 0; _28 = _26 & _27; if (_28 != 0) ``` we transform this into: ``` _26 = _7 == 0; _27 = c.2_5 == 0; if (c.2_5 == 0) ``` During FRE1 Which is correct. and _26 goes away later on. Then in evpr GCC changes: ``` # iftmp.8_29 = PHI <_7(4), 0(5)> ``` into: ``` # iftmp.8_29 = PHI <-1(4), 0(5)> ``` Which is also correct. Where it goes wrong is vrp1. We end up with this mess: ``` b.0_1 = b; _2 = b.0_1 == 0; _4 = (int) _2; c = _4; i.7_12 = (unsigned int) _2; _16 = b.0_1 != 0; _15 = _16 ? 1 : 2; if (_15 == 2) goto <bb 3>; [0.00%] else goto <bb 4>; [100.00%] <bb 3> [count: 0]: __builtin_unreachable (); ``` But that is basically: ``` ... if (b.0_1 == 0) __builtin_unreachable(); ``` ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/112542] [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d 2023-11-15 9:42 [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d theodort at inf dot ethz.ch 2023-11-15 11:59 ` [Bug tree-optimization/112542] " rguenth at gcc dot gnu.org 2023-11-15 16:48 ` pinskia at gcc dot gnu.org @ 2024-03-07 21:02 ` law at gcc dot gnu.org 2024-05-07 7:42 ` [Bug tree-optimization/112542] [14/15 " rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: law at gcc dot gnu.org @ 2024-03-07 21:02 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542 Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 CC| |law at gcc dot gnu.org ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/112542] [14/15 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d 2023-11-15 9:42 [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d theodort at inf dot ethz.ch ` (2 preceding siblings ...) 2024-03-07 21:02 ` law at gcc dot gnu.org @ 2024-05-07 7:42 ` rguenth at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: rguenth at gcc dot gnu.org @ 2024-05-07 7:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112542 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|14.0 |14.2 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- GCC 14.1 is being released, retargeting bugs to GCC 14.2. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-07 7:42 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-11-15 9:42 [Bug tree-optimization/112542] New: [14 Regression] Dead Code Elimination Regression since r14-4280-gc3c6f30496d theodort at inf dot ethz.ch 2023-11-15 11:59 ` [Bug tree-optimization/112542] " rguenth at gcc dot gnu.org 2023-11-15 16:48 ` pinskia at gcc dot gnu.org 2024-03-07 21:02 ` law at gcc dot gnu.org 2024-05-07 7:42 ` [Bug tree-optimization/112542] [14/15 " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).