[Bug tree-optimization/110327] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-4790-g4b3a325f07a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110327 --- Comment #3 from Jeffrey A. Law --- Two block copies isn't fatal when the second one is the one with the actual jump thread. But costing does get more complex. Basically we copy 8 so that we can isolate its two incoming paths which thread differently in bb10. That's pretty standard stuff. It looks like that particular threading possibility is hidden until after DOM3 is complete. Prior to and during DOM3, there's another block in the way. # c.3_16 = PHI <0(3), 2(5)> _9 = h; _10 = *_9; _11 = *_10; _12 = *_11; _13 = (char) _12; if (_13 != -28) goto ; [0.00%] else goto ; [100.00%] ;;succ: 8 ;;9 ;; basic block 8, loop depth 0 ;;pred: 7 __builtin_unreachable (); ;;succ: ;; basic block 9, loop depth 1 ;;pred: 7 if (_12 <= 4) goto ; [50.00%] else goto ; [50.00%] ;;succ: 10 ;;15 ;; basic block 10, loop depth 1 ;;pred: 9 _15 = d; *_10 = _15; if (c.3_16 <= 0) goto ; [5.50%] else goto ; [94.50%] Note bb9.
[Bug tree-optimization/110327] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-4790-g4b3a325f07a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110327 Jeffrey A. Law changed: What|Removed |Added Priority|P3 |P2 CC||law at gcc dot gnu.org
[Bug tree-optimization/110327] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-4790-g4b3a325f07a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110327 Andrew Pinski changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |NEW CC||pinskia at gcc dot gnu.org Last reconfirmed||2023-11-24 --- Comment #2 from Andrew Pinski --- Confirmed.
[Bug tree-optimization/110327] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-4790-g4b3a325f07a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110327 --- Comment #1 from Andrew Pinski --- What is interesting is that the call to foo is still there on the gimple level in GCC 11, it is only on the RTL level it is able to be removed What I see missing on the gimple level on the trunk is a jump threading opportunity (but might be too complex to do): [local count: 12528922893]: # c.3_16 = PHI <0(4), 2(7)> _9 = h; _10 = *_9; _11 = *_10; _12 = *_11; if (_12 <= 4) goto ; [50.00%] else goto ; [50.00%] ... [local count: 6264461501]: _15 = d; *_10 = _15; if (c.3_16 == 0) goto ; [5.50%] else goto ; [94.50%] [local count: 5919916023]: if (a.11_30 != 0) goto ; [33.00%] else goto ; [67.00%] The threading is: 4->8->10->11 7->8->10->12 This requires copying bb 8 and 10. I am not saying it is the right thing to do but rather that is how to optimize this out I think. There is also this one too: [local count: 12528922784]: # a.11_30 = PHI <_18(14), -28(2)> c.0_3 = c; if (a.11_30 != 0) goto ; [5.50%] else goto ; [94.50%] 2->3->4 14->3 But as I said I have not looked into more than that.
[Bug tree-optimization/110327] [12/13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r12-4790-g4b3a325f07a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110327 Richard Biener changed: What|Removed |Added Target Milestone|--- |12.4 Keywords||missed-optimization