https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95078
--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Richard Biener from comment #1) > TER should go away, not be extended. So you are suggesting that we replace > > leaq 44(%rdi,%rdx,4), %rdx --- redundant could be fwprop > movl (%rdx), %eax > movl $3, (%rsi) > addl (%rdx), %eax > > with > > movl 44(%rdi,%rdx,4), %eax > movl $3, (%rsi) > addl 44(%rdi,%rdx,4), %eax > Yes. > ? The variant that looks bigger is actually one byte smaller. Note as > soon as there are three uses it will be larger again... > > So this is really something for RTL and yeah, fwprop only makes "local" > decisions. Note that I think that your proposed variant will consume > more resources since the complex addressing modes are likely split into > a separate uop. Yes, overall I'd expect less latency for your sequence. Yes, also it will increase register pressure since propagation mostly would increase live range for base and index reg, it's a subtle optimization, maybe a cost model could help, and fwprop should be more "smart" to see the redundance of adress calculation after propagation.