[NFC] Fix unused var warning

This commit is contained in:
Jordan Rupprecht 2020-07-21 09:26:01 -07:00
parent 1c9cc094d0
commit 1ee1da1ea5
1 changed files with 3 additions and 4 deletions

View File

@ -387,26 +387,25 @@ struct FusionCandidateCompare {
bool operator()(const FusionCandidate &LHS,
const FusionCandidate &RHS) const {
const DominatorTree *DT = LHS.DT;
const PostDominatorTree *PDT = LHS.PDT;
BasicBlock *LHSEntryBlock = LHS.getEntryBlock();
BasicBlock *RHSEntryBlock = RHS.getEntryBlock();
// Do not save PDT to local variable as it is only used in asserts and thus
// will trigger an unused variable warning if building without asserts.
assert(DT && PDT && "Expecting valid dominator tree");
assert(DT && LHS.PDT && "Expecting valid dominator tree");
// Do this compare first so if LHS == RHS, function returns false.
if (DT->dominates(RHSEntryBlock, LHSEntryBlock)) {
// RHS dominates LHS
// Verify LHS post-dominates RHS
assert(PDT->dominates(LHSEntryBlock, RHSEntryBlock));
assert(LHS.PDT->dominates(LHSEntryBlock, RHSEntryBlock));
return false;
}
if (DT->dominates(LHSEntryBlock, RHSEntryBlock)) {
// Verify RHS Postdominates LHS
assert(PDT->dominates(RHSEntryBlock, LHSEntryBlock));
assert(LHS.PDT->dominates(RHSEntryBlock, LHSEntryBlock));
return true;
}