On 4/19/23 3:00 PM, Segher Boessenkool wrote: > On Wed, Apr 19, 2023 at 11:23:07PM +0530, Ajit Agarwal wrote: >> * common/config/rs6000/rs6000-common.cc: Add REE pass as a >> default rs6000 target pass for O2 and above. > > Why only for -O2? Only when optimising at all makes sense, people use > -O0 only when they want to skip as many optimisations as possible, maybe > because of compilation time concerns, maybe to avoid an ICE or other > bug. Isn't REE *always* a good thing, it never degrades code quality? > Or are there situations where it results in worse code?
I think this is a case of following what the other architectures are doing. Namely, x86, aarch64, riscv, sparc, alpha and h8300 all enable -free at -O2 and above, not -O1. Not to say that is the best answer, but I think that is why we did the same. I agree I don't think -free can produce worse code which makes using it with -O1 and above an option. Maybe someone was worried about compile time??? Doesn't seem like an optimization like this would be too expensive though. Ajit, one thing that is missing from this specific patch is a change to gcc/doc/invoke.texi mentioning Power to the list of architectures that are enabling -free with the -O* options, which currently only mentions Alpha, AArch64 and x86. Being good community participants, it'd be good to add the missing riscv, sparc and h8300 when adding Power. Peter