15
15
// / We associate a few shadow bits with every byte of the application memory,
16
16
// / poison the shadow of the malloc-ed or alloca-ed memory, load the shadow,
17
17
// / bits on every memory read, propagate the shadow bits through some of the
18
- // / arithmetic instruction (including MOV), store the shadow bits on every memory
19
- // / write, report a bug on some other instructions (e.g. JMP) if the
18
+ // / arithmetic instruction (including MOV), store the shadow bits on every
19
+ // / memory write, report a bug on some other instructions (e.g. JMP) if the
20
20
// / associated shadow is poisoned.
21
21
// /
22
22
// / But there are differences too. The first and the major one:
@@ -579,7 +579,7 @@ class MemorySanitizer {
579
579
580
580
Triple TargetTriple;
581
581
LLVMContext *C;
582
- Type *IntptrTy; // /< Integer type with the size of a ptr in default AS.
582
+ Type *IntptrTy; // /< Integer type with the size of a ptr in default AS.
583
583
Type *OriginTy;
584
584
PointerType *PtrTy; // /< Integer type with the size of a ptr in default AS.
585
585
@@ -840,7 +840,8 @@ static Constant *getOrInsertGlobal(Module &M, StringRef Name, Type *Ty) {
840
840
}
841
841
842
842
// / Insert declarations for userspace-specific functions and globals.
843
- void MemorySanitizer::createUserspaceApi (Module &M, const TargetLibraryInfo &TLI) {
843
+ void MemorySanitizer::createUserspaceApi (Module &M,
844
+ const TargetLibraryInfo &TLI) {
844
845
IRBuilder<> IRB (*C);
845
846
846
847
// Create the callback.
@@ -910,7 +911,8 @@ void MemorySanitizer::createUserspaceApi(Module &M, const TargetLibraryInfo &TLI
910
911
}
911
912
912
913
// / Insert extern declaration of runtime-provided functions and globals.
913
- void MemorySanitizer::initializeCallbacks (Module &M, const TargetLibraryInfo &TLI) {
914
+ void MemorySanitizer::initializeCallbacks (Module &M,
915
+ const TargetLibraryInfo &TLI) {
914
916
// Only do this once.
915
917
if (CallbacksInitialized)
916
918
return ;
@@ -1245,7 +1247,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
1245
1247
Value *End =
1246
1248
IRB.CreateUDiv (RoundUp, ConstantInt::get (MS.IntptrTy , kOriginSize ));
1247
1249
auto [InsertPt, Index] =
1248
- SplitBlockAndInsertSimpleForLoop (End, &*IRB.GetInsertPoint ());
1250
+ SplitBlockAndInsertSimpleForLoop (End, &*IRB.GetInsertPoint ());
1249
1251
IRB.SetInsertPoint (InsertPt);
1250
1252
1251
1253
Value *GEP = IRB.CreateGEP (MS.OriginTy , OriginPtr, Index);
@@ -1652,7 +1654,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
1652
1654
if (isa<ScalableVectorType>(V->getType ()))
1653
1655
return convertShadowToScalar (IRB.CreateOrReduce (V), IRB);
1654
1656
unsigned BitWidth =
1655
- V->getType ()->getPrimitiveSizeInBits ().getFixedValue ();
1657
+ V->getType ()->getPrimitiveSizeInBits ().getFixedValue ();
1656
1658
return IRB.CreateBitCast (V, IntegerType::get (*MS.C , BitWidth));
1657
1659
}
1658
1660
return V;
@@ -1691,7 +1693,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
1691
1693
Constant *constToIntPtr (Type *IntPtrTy, uint64_t C) const {
1692
1694
if (VectorType *VectTy = dyn_cast<VectorType>(IntPtrTy)) {
1693
1695
return ConstantVector::getSplat (
1694
- VectTy->getElementCount (), constToIntPtr (VectTy->getElementType (), C));
1696
+ VectTy->getElementCount (),
1697
+ constToIntPtr (VectTy->getElementType (), C));
1695
1698
}
1696
1699
assert (IntPtrTy == MS.IntptrTy );
1697
1700
return ConstantInt::get (MS.IntptrTy , C);
@@ -2008,8 +2011,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2008
2011
(void )Cpy;
2009
2012
2010
2013
if (MS.TrackOrigins ) {
2011
- Value *OriginPtr =
2012
- getOriginPtrForArgument (EntryIRB, ArgOffset);
2014
+ Value *OriginPtr = getOriginPtrForArgument (EntryIRB, ArgOffset);
2013
2015
// FIXME: OriginSize should be:
2014
2016
// alignTo(V % kMinOriginAlignment + Size, kMinOriginAlignment)
2015
2017
unsigned OriginSize = alignTo (Size, kMinOriginAlignment );
@@ -2032,8 +2034,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
2032
2034
ShadowPtr = EntryIRB.CreateAlignedLoad (getShadowTy (&FArg), Base,
2033
2035
kShadowTLSAlignment );
2034
2036
if (MS.TrackOrigins ) {
2035
- Value *OriginPtr =
2036
- getOriginPtrForArgument (EntryIRB, ArgOffset);
2037
+ Value *OriginPtr = getOriginPtrForArgument (EntryIRB, ArgOffset);
2037
2038
setOrigin (A, EntryIRB.CreateLoad (MS.OriginTy , OriginPtr));
2038
2039
}
2039
2040
}
@@ -4651,12 +4652,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
4651
4652
}
4652
4653
IRBuilder<> IRBAfter (&*NextInsn);
4653
4654
Value *RetvalShadow = IRBAfter.CreateAlignedLoad (
4654
- getShadowTy (&CB), getShadowPtrForRetval (IRBAfter),
4655
- kShadowTLSAlignment , " _msret" );
4655
+ getShadowTy (&CB), getShadowPtrForRetval (IRBAfter), kShadowTLSAlignment ,
4656
+ " _msret" );
4656
4657
setShadow (&CB, RetvalShadow);
4657
4658
if (MS.TrackOrigins )
4658
- setOrigin (&CB, IRBAfter.CreateLoad (MS.OriginTy ,
4659
- getOriginPtrForRetval ()));
4659
+ setOrigin (&CB, IRBAfter.CreateLoad (MS.OriginTy , getOriginPtrForRetval ()));
4660
4660
}
4661
4661
4662
4662
bool isAMustTailRetVal (Value *RetVal) {
0 commit comments