Skip to content

Commit

Permalink
[RLE-DSE]. Add NDEBUG and some comments in DSE. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
trentxintong committed Nov 30, 2015
1 parent 212110e commit 380ddd7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/SILPasses/Scalar/DeadStoreElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@ void DSEContext::updateWriteSetForRead(BBState *S, unsigned bit) {
void DSEContext::updateGenKillSetForRead(BBState *S, unsigned bit) {
// Start tracking the read to this MemLocation in the killset and update
// the genset accordingly.
//
// Even though, MemLocations are canonicalized, we still need to consult
// alias analysis to determine whether 2 MemLocations are disjointed.
MemLocation &R = MemLocationVault[bit];
for (unsigned i = 0; i < S->MemLocationNum; ++i) {
MemLocation &L = MemLocationVault[i];
Expand Down Expand Up @@ -594,13 +597,14 @@ void DSEContext::processRead(SILInstruction *I, BBState *S, SILValue Mem,
return;
}

#ifndef NDEBUG
// Make sure that the MemLocation getType() returns the same type as the
// loaded type.
if (auto *LI = dyn_cast<LoadInst>(I)) {
(void)LI;
assert(LI->getOperand().getType().getObjectType() == L.getType() &&
"MemLocation returns different type");
}
#endif

// Expand the given Mem into individual fields and process them as
// separate reads.
Expand Down Expand Up @@ -643,13 +647,14 @@ void DSEContext::processWrite(SILInstruction *I, BBState *S, SILValue Val,
if (!L.isValid())
return;

#ifndef NDEBUG
// Make sure that the MemLocation getType() returns the same type as the
// stored type.
if (auto *SI = dyn_cast<StoreInst>(I)) {
(void)SI;
assert(SI->getDest().getType().getObjectType() == L.getType() &&
"MemLocation returns different type");
}
#endif

// Expand the given Mem into individual fields and process them as separate
// writes.
Expand Down

0 comments on commit 380ddd7

Please sign in to comment.