[GVN] Fix MemorySSA update when replacing assume(false) with stores.
authorFlorian Hahn <flo@fhahn.com>
Thu, 5 Nov 2020 11:51:06 +0000 (11:51 +0000)
committerFlorian Hahn <flo@fhahn.com>
Thu, 5 Nov 2020 12:09:32 +0000 (12:09 +0000)
commitbe0578f0b44dfe6a3c3715a1c77b6ee9b6b65d3f
tree1615804b39ec7efa544e351891ef16a5dc9b6b4e
parent8ac9bcc746b9bb4b0ccdd71c6cbeda3b406e7b46
[GVN] Fix MemorySSA update when replacing assume(false) with stores.

When replacing an assume(false) with a store, we have to be more careful
with the order we insert the new access. This patch updates the code to
look at the accesses in the block to find a suitable insertion point.

Alterantively we could check the defining access of the assume, but IIRC
there has been some discussion about making assume() readnone, so
looking at the access list might be more future proof.

Fixes PR48072.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D90784
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/preserve-memoryssa.ll