Skip to content

Commit 79fa8be

Browse files
committed
[NFC][msan] Switch pointer to a reference
1 parent 07a722c commit 79fa8be

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,9 +1691,9 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
16911691
}
16921692
if (Argument *A = dyn_cast<Argument>(V)) {
16931693
// For arguments we compute the shadow on demand and store it in the map.
1694-
Value **ShadowPtr = &ShadowMap[V];
1695-
if (*ShadowPtr)
1696-
return *ShadowPtr;
1694+
Value *&ShadowPtr = ShadowMap[V];
1695+
if (ShadowPtr)
1696+
return ShadowPtr;
16971697
Function *F = A->getParent();
16981698
IRBuilder<> EntryIRB(FnPrologueEnd);
16991699
unsigned ArgOffset = 0;
@@ -1750,12 +1750,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
17501750

17511751
if (!PropagateShadow || Overflow || FArg.hasByValAttr() ||
17521752
(MS.EagerChecks && FArg.hasAttribute(Attribute::NoUndef))) {
1753-
*ShadowPtr = getCleanShadow(V);
1753+
ShadowPtr = getCleanShadow(V);
17541754
setOrigin(A, getCleanOrigin());
17551755
} else {
17561756
// Shadow over TLS
17571757
Value *Base = getShadowPtrForArgument(&FArg, EntryIRB, ArgOffset);
1758-
*ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,
1758+
ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,
17591759
kShadowTLSAlignment);
17601760
if (MS.TrackOrigins) {
17611761
Value *OriginPtr =
@@ -1764,14 +1764,14 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
17641764
}
17651765
}
17661766
LLVM_DEBUG(dbgs()
1767-
<< " ARG: " << FArg << " ==> " << **ShadowPtr << "\n");
1767+
<< " ARG: " << FArg << " ==> " << *ShadowPtr << "\n");
17681768
break;
17691769
}
17701770

17711771
ArgOffset += alignTo(Size, kShadowTLSAlignment);
17721772
}
1773-
assert(*ShadowPtr && "Could not find shadow for an argument");
1774-
return *ShadowPtr;
1773+
assert(ShadowPtr && "Could not find shadow for an argument");
1774+
return ShadowPtr;
17751775
}
17761776
// For everything else the shadow is zero.
17771777
return getCleanShadow(V);

0 commit comments

Comments
 (0)