projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
msan: Handle musttail calls
[oota-llvm.git]
/
lib
/
Transforms
/
Instrumentation
/
MemorySanitizer.cpp
diff --git
a/lib/Transforms/Instrumentation/MemorySanitizer.cpp
b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 3df1d15741203f62d22105a34df2946768942ec5..643faacc70053a22eb3c9a4daee3750def12be8b 100644
(file)
--- a/
lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/
lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@
-2356,6
+2356,12
@@
struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
VAHelper->visitCallSite(CS, IRB);
}
VAHelper->visitCallSite(CS, IRB);
}
+ // If this is a musttail call site, we can't insert propagation code here.
+ // The return type of the caller must match the callee, so the shadow should
+ // already be set up for an immediate return.
+ if (CS.isMustTailCall())
+ return;
+
// Now, get the shadow for the RetVal.
if (!I.getType()->isSized()) return;
IRBuilder<> IRBBefore(&I);
// Now, get the shadow for the RetVal.
if (!I.getType()->isSized()) return;
IRBuilder<> IRBBefore(&I);
@@
-2389,6
+2395,10
@@
struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
}
void visitReturnInst(ReturnInst &I) {
}
void visitReturnInst(ReturnInst &I) {
+ // Don't propagate shadow between musttail calls and the return.
+ if (I.getParent()->getTerminatingMustTailCall())
+ return;
+
IRBuilder<> IRB(&I);
Value *RetVal = I.getReturnValue();
if (!RetVal) return;
IRBuilder<> IRB(&I);
Value *RetVal = I.getReturnValue();
if (!RetVal) return;