On Fri, Nov 2, 2012 at 11:01 AM, Bin.Cheng wrote: > Hi Steven, > You mentioned the flag_gcse_las may be very useful for RISC machines in > thread : http://gcc.gnu.org/ml/gcc-patches/2012-10/msg00031.html > > I took some time to understand the code and think it should be workable with > hoist. However, I measured code size for CSiBE with "-fgcse-las" enabled but > found no benefit at all. > > Do you have some background information and the effect about this flag?
The "las" in flag_gcse_las is for "load after store". With -fgcse-las, RTL-PRE tries to eliminate loads from locations for which the last stored value is known. This used to happen a lot (and probably still does) on POWER when converting floats to ints and vice versa, because float-to-int and int-to-float conversions have to go through memory on POWER and this target detail isn't exposed in GIMPLE. In general, -fgcse-las can help eliminate memory operations that aren't exposed in GIMPLE but are visible in RTL before register allocation. This also applies e.g. to variables pushed to the stack by expand, or loads from constant pools if CONSTANT_POOL_ADDRESS_P could for some reason not be set on the load address. Finally, -fgcse-las eliminates partial-partial cases that tree-ssa-pre only catches if flag_tree_partial_pre is set (RTL PRE is LCM, which always eliminates the partial-partial cases). You wouldn't see this in code size tests because RTL PRE is not enabled at -Os. So the pass is helpful if you have target idiosyncrasies that are not visible in GIMPLE (most RISC targets have one or more such cases), and you're optimizing for code speed. For code hoisting, I don't expect -fgcse-las to do much. Cases of load-after-store that survive to RTL are probably eliminated by pass_cse already. Ciao! Steven