On Wed, Jan 08, 2020 at 07:12:29PM +0800, Bin.Cheng wrote: > I am a bit worried that would make IVOPTs heavy too,
Yeah. And ivopts already *is* heavy, by nature of what it does. Giving it extra work to do is not a good idea imo. > it might be > possible to compute heuristics whether loop should be unrolled as a > post-IVOPTs transformation. Right. Either ivopts or something before it (it can be a separate pass perhaps) should figure out which loops should be unrolled how much. The ivopts pass can then use that information, but the actual unrolling can be done much later (maybe even as late in RTL as it is now). > Of course the transformation needs to do > more work than simply unrolling in order to take advantage of > aforementioned addressing mode. > BTW, unrolled loop won't perform as good as ppc if the target doesn't > support [base + register + offset] addressing mode? PowerPC only has [reg+imm] and [reg+reg] addressing (and both of those can do plain [reg]). There is no [reg+reg+imm]. > Another point, in case of multiple passes doing unrolling, the > "already unrolled" information may need to be recorded as a flag of > loop properties. Right, or at least store how much the current plan says to unroll each loop, so that all passes can take that into account, or even adjust it if that is a good idea. Segher