On Thu, Dec 1, 2011 at 11:12 AM, Amker.Cheng <amker.ch...@gmail.com> wrote: > On Sat, Nov 26, 2011 at 3:41 PM, Amker.Cheng <amker.ch...@gmail.com> wrote: >> Hi, >> I looked into PR43491 a while and found in this case the gimple >> generated before pre >> is like: >> >> reg.0_12 = reg >> ... >> c() >> reg.0_1 = reg >> D.xxx = MEM[reg.0_1 + 8B] >> >> The pre pass transforms it into: >> >> reg.0_12 = reg >> ... >> c() >> reg.0_1 = reg.0_12 >> D.xxx = MEM[reg.0_1 + 8B] >> >> From now on, following passes(like copy_prop) can not transform it back and >> resulting in an additional mov instruction as the bug reported. >> >> The flow is like: >> 1, when rewriting gimple into ssa, reg is treated as a memory use; >> 2, seems pre noticed that reg is const and replace reg with reg.0_12, >> by this pre thinks it has eliminated an additional memory load operation; >> 3, following passes do not transform it back either because reg is treated >> as mem use or the const attribute is ignored. >> >> I think pre does the right thing given the information it knows, so wondering >> at which pass thing starts going wrong and how could this issue be handled? >> > > Should PRE be changed to global register variable aware, thus it does not > do the mentioned unnecessary elimination?
Well, it's not that easy if you still want to properly do redundant expression removal on global registers. Richard. > > -- > Best Regards.