mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
[msan] Fix shadow & origin store & load alignment.
This change ensures that shadow memory accesses have the same alignment as corresponding app memory accesses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168880 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -710,13 +710,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Type *ShadowTy = getShadowTy(&I);
|
||||
Value *Addr = I.getPointerOperand();
|
||||
Value *ShadowPtr = getShadowPtr(Addr, ShadowTy, IRB);
|
||||
setShadow(&I, IRB.CreateLoad(ShadowPtr, "_msld"));
|
||||
setShadow(&I, IRB.CreateAlignedLoad(ShadowPtr, I.getAlignment(), "_msld"));
|
||||
|
||||
if (ClCheckAccessAddress)
|
||||
insertCheck(I.getPointerOperand(), &I);
|
||||
|
||||
if (ClTrackOrigins)
|
||||
setOrigin(&I, IRB.CreateLoad(getOriginPtr(Addr, IRB)));
|
||||
setOrigin(&I, IRB.CreateAlignedLoad(getOriginPtr(Addr, IRB), I.getAlignment()));
|
||||
}
|
||||
|
||||
/// \brief Instrument StoreInst
|
||||
@@ -731,7 +731,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
Value *Shadow = getShadow(Val);
|
||||
Value *ShadowPtr = getShadowPtr(Addr, Shadow->getType(), IRB);
|
||||
|
||||
StoreInst *NewSI = IRB.CreateStore(Shadow, ShadowPtr);
|
||||
StoreInst *NewSI = IRB.CreateAlignedStore(Shadow, ShadowPtr, I.getAlignment());
|
||||
DEBUG(dbgs() << " STORE: " << *NewSI << "\n");
|
||||
// If the store is volatile, add a check.
|
||||
if (I.isVolatile())
|
||||
@@ -740,7 +740,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
||||
insertCheck(Addr, &I);
|
||||
|
||||
if (ClTrackOrigins)
|
||||
IRB.CreateStore(getOrigin(Val), getOriginPtr(Addr, IRB));
|
||||
IRB.CreateAlignedStore(getOrigin(Val), getOriginPtr(Addr, IRB), I.getAlignment());
|
||||
}
|
||||
|
||||
// Casts.
|
||||
|
Reference in New Issue
Block a user