[Bug tree-optimization/110903] [12/13 Regression] Dead Code Elimination Regression since r12-4526-gd8edfadfc7a979
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110903 Andrew Pinski changed: What|Removed |Added Target Milestone|12.4|14.0 --- Comment #7 from Andrew Pinski --- Fixed. I doubt this missed optimization patch can be backported so closing as fixed. Maybe it would be good to have a testcase committed for both cases though.
[Bug tree-optimization/110903] [12/13 Regression] Dead Code Elimination Regression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110903 --- Comment #6 from Thomas Koenig --- The original regression was caused by r12-4526-gd8edfadfc7a979 . d8edfadfc7a9795b65177a50ce44fd348858e844 is the first bad commit commit d8edfadfc7a9795b65177a50ce44fd348858e844 Author: Aldy Hernandez Date: Mon Oct 4 09:47:02 2021 +0200 Disallow loop rotation and loop header crossing in jump threaders. There is a lot of fall-out from this patch, as there were many threading tests that assumed the restrictions introduced by this patch were valid. Some tests have merely shifted the threading to after loop optimizations, but others ended up with no threading opportunities at all. Surprisingly some tests ended up with more total threads. It was a crapshoot all around. On a postive note, there are 6 tests that no longer XFAIL, and one guality test which now passes. I felt a bit queasy about such a fundamental change wrt threading, so I ran it through my callgrind test harness (.ii files from a bootstrap). There was no change in overall compilation, DOM, or the VRP threaders. However, there was a slight increase of 1.63% in the backward threader. I'm pretty sure we could reduce this if we incorporated the restrictions into their profitability code. This way we could stop the search when we ran into one of these restrictions. Not sure it's worth it at this point. Tested on x86-64 Linux. Co-authored-by: Richard Biener
[Bug tree-optimization/110903] [12/13 Regression] Dead Code Elimination Regression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110903 Thomas Koenig changed: What|Removed |Added Summary|[12/13/14 Regression] Dead |[12/13 Regression] Dead |Code Elimination Regression |Code Elimination Regression --- Comment #5 from Thomas Koenig --- (In reply to Andrew Pinski from comment #4) > (In reply to Thomas Koenig from comment #3) > > The code from comment#2 and from comment#3 no longer calls foo > > with current trunk, r14-5108-g751fc7bcdcdf25 . > > > > Now, to see which commit fixed it... > > My bet is on r14-4089-gd45ddc2c04e471 . Weird thing is that I do see this on POWER (I often use gcc120 for compiling because it is the beefiest machine I can lay my hands on). However, this was actually fixed by r14-4141-gbf6b107e2a3423: bf6b107e2a342319b3787ec960fc8014ef3aff91 is the first new commit commit bf6b107e2a342319b3787ec960fc8014ef3aff91 Author: Andrew MacLeod Date: Wed Sep 13 11:52:15 2023 -0400 New early __builtin_unreachable processing. in VRP passes before __builtin_unreachable MUST be removed, only remove it if all exports affected by the unreachable can have global values updated, and do not involve loads from memory. PR tree-optimization/110080 PR tree-optimization/110249 gcc/ * tree-vrp.cc (remove_unreachable::final_p): New. (remove_unreachable::maybe_register): Rename from maybe_register_block and call early or final routine. (fully_replaceable): New. (remove_unreachable::handle_early): New. (remove_unreachable::remove_and_update_globals): Remove non-final processing. (rvrp_folder::rvrp_folder): Add final flag to constructor. (rvrp_folder::post_fold_bb): Remove unreachable registration. (rvrp_folder::pre_fold_stmt): Move unreachable processing to here. (execute_ranger_vrp): Adjust some call parameters. gcc/testsuite/ * g++.dg/pr110249.C: New. * gcc.dg/pr110080.c: New. * gcc.dg/pr93917.c: Adjust.