------- Comment #4 from carrot at google dot com 2009-05-31 08:05 ------- (In reply to comment #3) > I think we have enough passes already and should try to stuff this in cse.c > and > fwprop.c. See PR middle-end/33699 for related issues. >
It looks that patch solved some similar issues. But there are still several differences: 1. PR/33699 can only handle constant addresses, while in my case the addresses are not constants. And I believe non-constant cases (memory accesses through pointer) occurs more frequently than constant addresses(embedded system only?). 2. That patch can only be applicable to known base address. While in my case, the known base address of memory accesses are the pointer to struct, there is no known nearby base address, so we need to create a new nearby base address. 3. That patch works on superblock, but it looks better to optimize the memory accesses on the whole function body, it is quite common to access memory through same pointer in different basic blocks, as shown in mcf. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40314