This commit fixes a missed opportunity in merging consecutive stores. The code that searches for stores skipped the case of stores that directly connect to the root. The comment above the implementation lists this case but the code did not handle it. I found this pattern when looking into the shared_ptr destructor. GCC generates the right sequence. Here is a small repo:
int foo(int* buff) { buff[0] = 0; int x = buff[1]; buff[1] = 0; return x; }
Does it matter if Store3 interferes with one of the loads? Wondering if it is dealt with somewhere, otherwise merging store3 with the stores following the loads might cause be a problem.