[PATCH] D26659: [MemorySSA] Invoke the right getModRefInfo check in `instructionClobbersQuery` when UseLoc is passed.
bryant via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 22:59:51 PST 2016
bryant created this revision.
bryant added reviewers: dberlin, george.burgess.iv, hfinkel.
bryant added a subscriber: llvm-commits.
bryant set the repository for this revision to rL LLVM.
Calls to `instructionClobbersQuery` are meant to answer two kinds of queries:
Given two memory instructions X and Y,
- Does X clobber Y?
- Does X clobber Y with respect to a MemoryLocation UseLoc?
For queries of the first kind, a null MemoryLocation is passed, and it makes
sense for `getModRefInfo(Instruction *, ImmutableCallSite)` to be called.
For the second kind, however, UseLoc would be a non-null and the above call to
`getModRefInfo` would be unnecessarily conservative; it would be sufficient to
check `getModRefInfo(Instruction *, const MemoryLocation &)`.
An example:
call void @llvm.memcpy(i8* %dest, i8* %src, i64 128, ...) ; MemoryDef *M0
call void @llvm.memcpy(i8* %dest, i8* %src, i64 128, ...) ; MemoryDef *M1
The call
instructionClobbersQuery(M0, MemoryLocation::getForSource(M1->getMemoryInst()),
M1->getMemoryInst(), AA)
would return true -- that M0 does clobber M1's source. But this can't possibly
be the case since overlapping memcpy operands are UB.
Repository:
rL LLVM
https://reviews.llvm.org/D26659
Files:
lib/Transforms/Utils/MemorySSA.cpp
Index: lib/Transforms/Utils/MemorySSA.cpp
===================================================================
--- lib/Transforms/Utils/MemorySSA.cpp
+++ lib/Transforms/Utils/MemorySSA.cpp
@@ -235,7 +235,7 @@
}
ImmutableCallSite UseCS(UseInst);
- if (UseCS) {
+ if (UseCS && UseLoc == MemoryLocation()) {
ModRefInfo I = AA.getModRefInfo(DefInst, UseCS);
return I != MRI_NoModRef;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26659.77946.patch
Type: text/x-patch
Size: 404 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/32f392f5/attachment.bin>
More information about the llvm-commits
mailing list