This is essentially just https://reviews.llvm.org/D68006 with a few fixes for the comments.
To address the last comment about the CFG visiting: This simply prevents DSE from analyzing through back-edges (and instead assuming memory modification) because it had the potential to break certain types of loops. I heard somewhere that there will be a proper fix for this in @fhahn 's MemorySSA-backed DSE, so this is essentially a band-aid I suppose.
Don't know who to tag for this, sorry.