Skip to content

Commit e1f60b1

Browse files
author
Sebastian Pop
committedJun 10, 2016
MemorySSA: fix memory access local dominance function for live on entry
A memory access defined on function entry cannot be locally dominated by another memory access. The patch was split from http://reviews.llvm.org/D19338 which exposes the problem. Differential Revision: http://reviews.llvm.org/D21039 llvm-svn: 272436
1 parent 39c226f commit e1f60b1

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎llvm/lib/Transforms/Utils/MemorySSA.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,21 @@ bool MemorySSA::locallyDominates(const MemoryAccess *Dominator,
623623

624624
assert((Dominator->getBlock() == Dominatee->getBlock()) &&
625625
"Asking for local domination when accesses are in different blocks!");
626+
627+
// A node dominates itself.
628+
if (Dominatee == Dominator)
629+
return true;
630+
631+
// When Dominatee is defined on function entry, it is not dominated by another
632+
// memory access.
633+
if (isLiveOnEntryDef(Dominatee))
634+
return false;
635+
636+
// When Dominator is defined on function entry, it dominates the other memory
637+
// access.
638+
if (isLiveOnEntryDef(Dominator))
639+
return true;
640+
626641
// Get the access list for the block
627642
const AccessListType *AccessList = getBlockAccesses(Dominator->getBlock());
628643
AccessListType::const_reverse_iterator It(Dominator->getIterator());

0 commit comments

Comments
 (0)
Please sign in to comment.