llvm/test/Transforms/Util/MemorySSA
George Burgess IV ff01852cd7 [MemorySSA] Make the visitor more careful with calls.
Prior to this patch, the MemorySSA caching visitor would cache all
calls that it visited. When paired with phi optimization, this can be
problematic. Consider:

define void @foo() {
  ; 1 = MemoryDef(liveOnEntry)
  call void @clobberFunction()
  br i1 undef, label %if.end, label %if.then

if.then:
  ; MemoryUse(??)
  call void @readOnlyFunction()
  ; 2 = MemoryDef(1)
  call void @clobberFunction()
  br label %if.end

if.end:
  ; 3 = MemoryPhi(...)
  ; MemoryUse(?)
  call void @readOnlyFunction()
  ret void
}

When optimizing MemoryUse(?), we visit defs 1 and 2, so we note to
cache them later. We ultimately end up not being able to optimize
passed the Phi, so we set MemoryUse(?) to point to the Phi. We then
cache the clobbering call for def 1 to be the Phi.

This commit changes this behavior so that we wipe out any calls
added to VisistedCalls while visiting the defs of a phi we couldn't
optimize.

Aside: With this patch, we now can bootstrap clang/LLVM without a
single MemorySSA verifier failure. Woohoo. :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@264820 91177308-0d34-0410-b5e6-96231b3b80d8
2016-03-30 03:12:08 +00:00
..
atomic-clobber.ll
cyclicphi.ll [MemorySSA] Change how the walker views/walks visited phis. 2016-03-30 00:26:26 +00:00
function-clobber.ll [MemorySSA] Make the visitor more careful with calls. 2016-03-30 03:12:08 +00:00
function-mem-attrs.ll
livein.ll [MemorySSA] Consider def-only BBs for live-in calculations. 2016-03-21 21:25:39 +00:00
load-invariant.ll
many-dom-backedge.ll
many-doms.ll
multi-edges.ll
multiple-backedges-hal.ll
multiple-locations.ll Add a test for MemorySSA. NFC. 2016-02-05 00:42:02 +00:00
no-disconnected.ll
optimize-use.ll
phi-translation.ll [MemorySSA] Change how the walker views/walks visited phis. 2016-03-30 00:26:26 +00:00
volatile-clobber.ll