[llvm-commits] [llvm] r168911 - /llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Matt Beaumont-Gay
matthewbg at google.com
Thu Nov 29 10:15:49 PST 2012
Author: matthewbg
Date: Thu Nov 29 12:15:49 2012
New Revision: 168911
URL: http://llvm.org/viewvc/llvm-project?rev=168911&view=rev
Log:
Apply Takumi's patch to suppress unused-variable warnings in -Asserts builds.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=168911&r1=168910&r2=168911&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Thu Nov 29 12:15:49 2012
@@ -601,6 +601,7 @@
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 @@
if (UndefValue *U = dyn_cast<UndefValue>(V)) {
Value *AllOnes = getPoisonedShadow(getShadowTy(V));
DEBUG(dbgs() << "Undef: " << *U << " ==> " << *AllOnes << "\n");
+ (void)U;
return AllOnes;
}
if (Argument *A = dyn_cast<Argument>(V)) {
@@ -636,6 +638,7 @@
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 @@
if (!InsertChecks) return;
Instruction *Shadow = dyn_cast_or_null<Instruction>(getShadow(Val));
if (!Shadow) return;
+#ifndef NDEBUG
Type *ShadowTy = Shadow->getType();
assert((isa<IntegerType>(ShadowTy) || isa<VectorType>(ShadowTy)) &&
"Can only insert checks for integer and vector shadow types");
+#endif
Instruction *Origin = dyn_cast_or_null<Instruction>(getOrigin(Val));
InstrumentationList.push_back(
ShadowOriginAndInsertPoint(Shadow, Origin, OrigIns));
@@ -704,8 +709,7 @@
/// 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 @@
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);
More information about the llvm-commits
mailing list