Skip to content

Commit 380ddd7

Browse files
committed
[RLE-DSE]. Add NDEBUG and some comments in DSE. NFC
1 parent 212110e commit 380ddd7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/SILPasses/Scalar/DeadStoreElimination.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,9 @@ void DSEContext::updateWriteSetForRead(BBState *S, unsigned bit) {
529529
void DSEContext::updateGenKillSetForRead(BBState *S, unsigned bit) {
530530
// Start tracking the read to this MemLocation in the killset and update
531531
// the genset accordingly.
532+
//
533+
// Even though, MemLocations are canonicalized, we still need to consult
534+
// alias analysis to determine whether 2 MemLocations are disjointed.
532535
MemLocation &R = MemLocationVault[bit];
533536
for (unsigned i = 0; i < S->MemLocationNum; ++i) {
534537
MemLocation &L = MemLocationVault[i];
@@ -594,13 +597,14 @@ void DSEContext::processRead(SILInstruction *I, BBState *S, SILValue Mem,
594597
return;
595598
}
596599

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

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

650+
#ifndef NDEBUG
646651
// Make sure that the MemLocation getType() returns the same type as the
647652
// stored type.
648653
if (auto *SI = dyn_cast<StoreInst>(I)) {
649-
(void)SI;
650654
assert(SI->getDest().getType().getObjectType() == L.getType() &&
651655
"MemLocation returns different type");
652656
}
657+
#endif
653658

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

0 commit comments

Comments
 (0)