diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2016-03-30 03:12:08 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2016-03-30 03:12:08 +0000 |
commit | 49cad7d70b663a1f258c40cbc94deb01cd4ba5df (patch) | |
tree | 7d0ae225a1f8b812db8e2a8d9ff9948173a5b7be /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | 81c3ddeb1c24671c03a25420745ca38efba42263 (diff) | |
download | bcm5719-llvm-49cad7d70b663a1f258c40cbc94deb01cd4ba5df.tar.gz bcm5719-llvm-49cad7d70b663a1f258c40cbc94deb01cd4ba5df.zip |
[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. :)
llvm-svn: 264820
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions