This fixes PR31777.
If both stores' values are ConstantInt, we merge the two stores
(shifting the smaller store appropriately) and replace the earlier (and
larger) store with an updated constant.
In the future we should also support vectors of integers. And maybe
float/double if we can.
I think @filcab is unable to get back to this patch currently and D29866 is not progressing.
I don't have a full understanding of DSE, but I'll propose a one-word fix to this patch (and an additional test case). It should avoid the bug that caused the patch to be reverted ( https://bugs.llvm.org/show_bug.cgi?id=34074 ).
This 'continue' should be a 'break'. We killed 'Inst' above, so 'InstDep' is no longer valid. Therefore, we can't carry on in the inner loop; we need to break back out to the outer loop and really 'start over' as the comment already says. :)