1515// / We associate a few shadow bits with every byte of the application memory,
1616// / poison the shadow of the malloc-ed or alloca-ed memory, load the shadow,
1717// / bits on every memory read, propagate the shadow bits through some of 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
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
2020// / associated shadow is poisoned.
2121// /
2222// / But there are differences too. The first and the major one:
@@ -579,7 +579,7 @@ class MemorySanitizer {
579579
580580 Triple TargetTriple;
581581 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.
583583 Type *OriginTy;
584584 PointerType *PtrTy; // /< Integer type with the size of a ptr in default AS.
585585
@@ -840,8 +840,7 @@ static Constant *getOrInsertGlobal(Module &M, StringRef Name, Type *Ty) {
840840}
841841
842842// / Insert declarations for userspace-specific functions and globals.
843- void MemorySanitizer::createUserspaceApi (Module &M,
844- const TargetLibraryInfo &TLI) {
843+ void MemorySanitizer::createUserspaceApi (Module &M, const TargetLibraryInfo &TLI) {
845844 IRBuilder<> IRB (*C);
846845
847846 // Create the callback.
@@ -911,8 +910,7 @@ void MemorySanitizer::createUserspaceApi(Module &M,
911910}
912911
913912// / Insert extern declaration of runtime-provided functions and globals.
914- void MemorySanitizer::initializeCallbacks (Module &M,
915- const TargetLibraryInfo &TLI) {
913+ void MemorySanitizer::initializeCallbacks (Module &M, const TargetLibraryInfo &TLI) {
916914 // Only do this once.
917915 if (CallbacksInitialized)
918916 return ;
@@ -1247,7 +1245,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
12471245 Value *End =
12481246 IRB.CreateUDiv (RoundUp, ConstantInt::get (MS.IntptrTy , kOriginSize ));
12491247 auto [InsertPt, Index] =
1250- SplitBlockAndInsertSimpleForLoop (End, &*IRB.GetInsertPoint ());
1248+ SplitBlockAndInsertSimpleForLoop (End, &*IRB.GetInsertPoint ());
12511249 IRB.SetInsertPoint (InsertPt);
12521250
12531251 Value *GEP = IRB.CreateGEP (MS.OriginTy , OriginPtr, Index);
@@ -1654,7 +1652,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
16541652 if (isa<ScalableVectorType>(V->getType ()))
16551653 return convertShadowToScalar (IRB.CreateOrReduce (V), IRB);
16561654 unsigned BitWidth =
1657- V->getType ()->getPrimitiveSizeInBits ().getFixedValue ();
1655+ V->getType ()->getPrimitiveSizeInBits ().getFixedValue ();
16581656 return IRB.CreateBitCast (V, IntegerType::get (*MS.C , BitWidth));
16591657 }
16601658 return V;
@@ -1693,8 +1691,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
16931691 Constant *constToIntPtr (Type *IntPtrTy, uint64_t C) const {
16941692 if (VectorType *VectTy = dyn_cast<VectorType>(IntPtrTy)) {
16951693 return ConstantVector::getSplat (
1696- VectTy->getElementCount (),
1697- constToIntPtr (VectTy->getElementType (), C));
1694+ VectTy->getElementCount (), constToIntPtr (VectTy->getElementType (), C));
16981695 }
16991696 assert (IntPtrTy == MS.IntptrTy );
17001697 return ConstantInt::get (MS.IntptrTy , C);
@@ -2011,7 +2008,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20112008 (void )Cpy;
20122009
20132010 if (MS.TrackOrigins ) {
2014- Value *OriginPtr = getOriginPtrForArgument (EntryIRB, ArgOffset);
2011+ Value *OriginPtr =
2012+ getOriginPtrForArgument (EntryIRB, ArgOffset);
20152013 // FIXME: OriginSize should be:
20162014 // alignTo(V % kMinOriginAlignment + Size, kMinOriginAlignment)
20172015 unsigned OriginSize = alignTo (Size, kMinOriginAlignment );
@@ -2034,7 +2032,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
20342032 ShadowPtr = EntryIRB.CreateAlignedLoad (getShadowTy (&FArg), Base,
20352033 kShadowTLSAlignment );
20362034 if (MS.TrackOrigins ) {
2037- Value *OriginPtr = getOriginPtrForArgument (EntryIRB, ArgOffset);
2035+ Value *OriginPtr =
2036+ getOriginPtrForArgument (EntryIRB, ArgOffset);
20382037 setOrigin (A, EntryIRB.CreateLoad (MS.OriginTy , OriginPtr));
20392038 }
20402039 }
@@ -4652,11 +4651,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
46524651 }
46534652 IRBuilder<> IRBAfter (&*NextInsn);
46544653 Value *RetvalShadow = IRBAfter.CreateAlignedLoad (
4655- getShadowTy (&CB), getShadowPtrForRetval (IRBAfter), kShadowTLSAlignment ,
4656- " _msret" );
4654+ getShadowTy (&CB), getShadowPtrForRetval (IRBAfter),
4655+ kShadowTLSAlignment , " _msret" );
46574656 setShadow (&CB, RetvalShadow);
46584657 if (MS.TrackOrigins )
4659- setOrigin (&CB, IRBAfter.CreateLoad (MS.OriginTy , getOriginPtrForRetval ()));
4658+ setOrigin (&CB, IRBAfter.CreateLoad (MS.OriginTy ,
4659+ getOriginPtrForRetval ()));
46604660 }
46614661
46624662 bool isAMustTailRetVal (Value *RetVal) {
0 commit comments