This disables postreload GCSE the same way we disable GCSE/cprop. On the PR36262 testcase this removes
load CSE after reload : 129.00 ( 72%) 0.08 ( 5%) 130.50 ( 72%) 6 kB ( 0%) With a smaller testcase both PRE and postreload GCSE still run and GCSE shows itself roughly 2x the cost of postreload GCSE there (still wondering why we have two implementations of the same thing?!) I've seem postreload CSE pop up a lot on larger testcases while PRE turns itself off. So, does this look reasonable? Thanks, Richard. 2019-09-02 Richard Biener <rguent...@suse.de> PR rtl-optimization/36262 * postreload-gcse.c: Include intl.h and gcse.h. (gcse_after_reload_main): Skip pass if gcse_or_cprop_is_too_expensive says so. Index: gcc/postreload-gcse.c =================================================================== --- gcc/postreload-gcse.c (revision 275294) +++ gcc/postreload-gcse.c (working copy) @@ -38,7 +38,9 @@ along with GCC; see the file COPYING3. #include "params.h" #include "tree-pass.h" #include "dbgcnt.h" +#include "intl.h" #include "gcse-common.h" +#include "gcse.h" /* The following code implements gcse after reload, the purpose of this pass is to cleanup redundant loads generated by reload and other @@ -1371,6 +1373,10 @@ delete_redundant_insns (void) static void gcse_after_reload_main (rtx f ATTRIBUTE_UNUSED) { + /* Return if it is too expensive. */ + if (gcse_or_cprop_is_too_expensive (_("load CSE after register allocation " + "disabled"))) + return; memset (&stats, 0, sizeof (stats));