[Bug tree-optimization/110177] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-2305-g398572c1544
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110177 Jeffrey A. Law changed: What|Removed |Added Priority|P3 |P2 CC||law at gcc dot gnu.org
[Bug tree-optimization/110177] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-2305-g398572c1544
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110177 --- Comment #3 from Theodoros Theodoridis --- I think the correct bisection is: r11-3063-gfcae5121154 (or its parent r11-3062-g90e88fd376b) I can't build its parent but with its grandparent r11-3061-g1644d7f4c1c the call to foo is eliminated: gcc-1644d7f4c1c4f99231d7de5e35fa7ce2d2e2c4c6 -Os test.c -S -o /dev/stdout main: movqg(%rip), %rax movl$0, c(%rip) movq(%rax), %rdx movq%rdx, f(%rip) testq %rdx, %rdx je .L2 movq(%rax), %rax movq%rax, f(%rip) testq %rax, %rax jne .L8 movl$9, c(%rip) .L2: pushq %rax xorl%eax, %eax call__assert_fail .L8: movl$27, c(%rip) xorl%eax, %eax movl$0, e(%rip) ret r11-3063-gfcae5121154 with ranger disabled generates the same code gcc-fcae5121154d1c3382b056bcc2c563cedac28e74 -Os test.c -S -o /dev/stdout: main: movqg(%rip), %rax movl$0, c(%rip) movq(%rax), %rdx movq%rdx, f(%rip) testq %rdx, %rdx je .L2 movq(%rax), %rax movq%rax, f(%rip) testq %rax, %rax jne .L8 movl$9, c(%rip) .L2: pushq %rax xorl%eax, %eax call__assert_fail .L8: movl$27, c(%rip) xorl%eax, %eax movl$0, e(%rip) ret with ranger enabled it doesn't eliminate the call and generates mode code: gcc-fcae5121154d1c3382b056bcc2c563cedac28e74 -Os -fevrp-mode=ranger test.c -S -o /dev/stdout: main: pushq %rcx movle(%rip), %edi xorl%eax, %eax xorl%edx, %edx movl$0, c(%rip) movqg(%rip), %r8 .L2: movl%eax, %esi cmpl$27, %eax je .L20 testl %eax, %eax je .L3 movl%edi, %ecx movl%eax, %r9d movl%eax, %r10d sall%cl, %r9d movl%r9d, %ecx sarl%cl, %r10d testw %r10w, %r10w je .L3 movl%eax, c(%rip) .L3: movq(%r8), %rcx addl$9, %eax movq%rcx, f(%rip) testq %rcx, %rcx jne .L8 testb %dl, %dl je .L4 movl%esi, c(%rip) .L4: xorl%eax, %eax call__assert_fail .L8: movb$1, %dl jmp .L2 .L20: testb %dl, %dl je .L6 movl$27, c(%rip) .L6: cmpq$0, f(%rip) movl$0, e(%rip) jne .L7 callfoo .L7: xorl%eax, %eax popq%rdx ret
[Bug tree-optimization/110177] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-2305-g398572c1544
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110177 Andrew Pinski changed: What|Removed |Added Last reconfirmed||2023-06-08 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski --- Confirmed. But I don't think r12-2305-g398572c1544 caused it ...
[Bug tree-optimization/110177] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-2305-g398572c1544
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110177 --- Comment #1 from Andrew Pinski --- Hmm, in ccp1, GCC 11.3 does: Visiting statement: # RANGE [0, 0] NONZERO 0 b_33 = (short intD.25) _11; which is likely CONSTANT Applying pattern match.pd:3405, gimple-match.c:27041 Applying pattern match.pd:3322, gimple-match.c:26980 Match-and-simplified (short int) _11 to _10 Lattice value changed to CONSTANT 0. Adding SSA edges to worklist. marking stmt to be not simulated again Visiting statement: if (b_33 != 0) which is likely CONSTANT Adding destination of edge (4 -> 6) to worklist marking stmt to be not simulated again While in GCC 12+ does: Visiting statement: b_33 = (short intD.25) _11; which is likely CONSTANT Applying pattern match.pd:3730, gimple-match.cc:69683 Applying pattern match.pd:3647, gimple-match.cc:69622 Match-and-simplified (short int) _11 to _10 Lattice value changed to CONSTANT _10. Adding SSA edges to worklist. marking stmt to be not simulated again Visiting statement: if (b_33 != 0) which is likely CONSTANT Matching expression match.pd:2118, generic-match.cc:693 Matching expression match.pd:2121, generic-match.cc:753 Matching expression match.pd:2128, generic-match.cc:776 Adding destination of edge (4 -> 5) to worklist Adding destination of edge (4 -> 6) to worklist
[Bug tree-optimization/110177] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-2305-g398572c1544
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110177 Andrew Pinski changed: What|Removed |Added Target Milestone|--- |12.4 Keywords||missed-optimization