mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
[msan] Add compile-time checks for missing origins.
This change makes MemorySanitizer instrumentation a bit more strict about instructions that have no origin id assigned to them. This would have caught the bug that was fixed in r222918. No functional change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222997 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b9cea42db
commit
f1b5d9ae6e
@ -921,6 +921,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
Value *OriginPtr =
|
Value *OriginPtr =
|
||||||
getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
|
getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);
|
||||||
setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
|
setOrigin(A, EntryIRB.CreateLoad(OriginPtr));
|
||||||
|
} else {
|
||||||
|
setOrigin(A, getCleanOrigin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
|
ArgOffset += RoundUpToAlignment(Size, kShadowTLSAlignment);
|
||||||
@ -940,15 +942,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
/// \brief Get the origin for a value.
|
/// \brief Get the origin for a value.
|
||||||
Value *getOrigin(Value *V) {
|
Value *getOrigin(Value *V) {
|
||||||
if (!MS.TrackOrigins) return nullptr;
|
if (!MS.TrackOrigins) return nullptr;
|
||||||
if (isa<Instruction>(V) || isa<Argument>(V)) {
|
if (!PropagateShadow) return getCleanOrigin();
|
||||||
Value *Origin = OriginMap[V];
|
if (isa<Constant>(V)) return getCleanOrigin();
|
||||||
if (!Origin) {
|
assert((isa<Instruction>(V) || isa<Argument>(V)) &&
|
||||||
DEBUG(dbgs() << "NO ORIGIN: " << *V << "\n");
|
"Unexpected value type in getOrigin()");
|
||||||
Origin = getCleanOrigin();
|
Value *Origin = OriginMap[V];
|
||||||
}
|
assert(Origin && "Missing origin");
|
||||||
return Origin;
|
return Origin;
|
||||||
}
|
|
||||||
return getCleanOrigin();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Get the origin for i-th argument of the instruction I.
|
/// \brief Get the origin for i-th argument of the instruction I.
|
||||||
@ -1088,6 +1088,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||||||
IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
|
IRB.CreateStore(getCleanShadow(&I), ShadowPtr);
|
||||||
|
|
||||||
setShadow(&I, getCleanShadow(&I));
|
setShadow(&I, getCleanShadow(&I));
|
||||||
|
setOrigin(&I, getCleanOrigin());
|
||||||
}
|
}
|
||||||
|
|
||||||
void visitAtomicRMWInst(AtomicRMWInst &I) {
|
void visitAtomicRMWInst(AtomicRMWInst &I) {
|
||||||
|
Loading…
Reference in New Issue
Block a user