From: Matt Beaumont-Gay Date: Thu, 29 Nov 2012 18:15:49 +0000 (+0000) Subject: Apply Takumi's patch to suppress unused-variable warnings in -Asserts builds. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cb5d04a9045b59d6aaf8707c63e9a90ad7a40c08;p=oota-llvm.git Apply Takumi's patch to suppress unused-variable warnings in -Asserts builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168911 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 4b14f44d8ec..1dfe94bf326 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -601,6 +601,7 @@ struct MemorySanitizerVisitor : public InstVisitor { Value *Shadow = ShadowMap[V]; if (!Shadow) { DEBUG(dbgs() << "No shadow: " << *V << "\n" << *(I->getParent())); + (void)I; assert(Shadow && "No shadow for a value"); } return Shadow; @@ -608,6 +609,7 @@ struct MemorySanitizerVisitor : public InstVisitor { if (UndefValue *U = dyn_cast(V)) { Value *AllOnes = getPoisonedShadow(getShadowTy(V)); DEBUG(dbgs() << "Undef: " << *U << " ==> " << *AllOnes << "\n"); + (void)U; return AllOnes; } if (Argument *A = dyn_cast(V)) { @@ -636,6 +638,7 @@ struct MemorySanitizerVisitor : public InstVisitor { getShadowPtr(V, EntryIRB.getInt8Ty(), EntryIRB), Base, Size, AI->getParamAlignment()); DEBUG(dbgs() << " ByValCpy: " << *Cpy << "\n"); + (void)Cpy; *ShadowPtr = getCleanShadow(V); } else { *ShadowPtr = EntryIRB.CreateLoad(Base); @@ -689,9 +692,11 @@ struct MemorySanitizerVisitor : public InstVisitor { if (!InsertChecks) return; Instruction *Shadow = dyn_cast_or_null(getShadow(Val)); if (!Shadow) return; +#ifndef NDEBUG Type *ShadowTy = Shadow->getType(); assert((isa(ShadowTy) || isa(ShadowTy)) && "Can only insert checks for integer and vector shadow types"); +#endif Instruction *Origin = dyn_cast_or_null(getOrigin(Val)); InstrumentationList.push_back( ShadowOriginAndInsertPoint(Shadow, Origin, OrigIns)); @@ -704,8 +709,7 @@ struct MemorySanitizerVisitor : public InstVisitor { /// Loads the corresponding shadow and (optionally) origin. /// Optionally, checks that the load address is fully defined. void visitLoadInst(LoadInst &I) { - Type *LoadTy = I.getType(); - assert(LoadTy->isSized() && "Load type must have size"); + assert(I.getType()->isSized() && "Load type must have size"); IRBuilder<> IRB(&I); Type *ShadowTy = getShadowTy(&I); Value *Addr = I.getPointerOperand(); @@ -733,6 +737,7 @@ struct MemorySanitizerVisitor : public InstVisitor { StoreInst *NewSI = IRB.CreateAlignedStore(Shadow, ShadowPtr, I.getAlignment()); DEBUG(dbgs() << " STORE: " << *NewSI << "\n"); + (void)NewSI; // If the store is volatile, add a check. if (I.isVolatile()) insertCheck(Val, &I);