> - If I patch in this code, actually I get the same results I did > before where the constants are propagated. It seems that in 4.3.2, > every part of the compiler is trying to do that.
There are at least two forward propagation passes, one before and another after GCSE. I haven't tried to tackle those passes, but I believe they already have a cost model in place. This patch will prevent partial sums involving registers and constants from being combined during GCSE. > - Just for testing I turned off the GCSE pass and it still > propagated and folded the constants... GCSE won't help with your trimmed down example int main(void) { long a = 0xcafecafe; printf("Final: %lx %lx %lx\n", a, a+5, a+15); return EXIT_SUCCESS; } I believe Paolo's canon_reg solution together with tweaking rtx_cost of constants with outer code PLUS might help. Any luck with that pass?