Skip to content

Commit 9b5284c

Browse files
committed
Ensure whenever CSE's DenseMapInfo's isEqual is true, hash codes of its inputs are same
1 parent b284955 commit 9b5284c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/SILOptimizer/Transforms/CSE.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,10 @@ bool llvm::DenseMapInfo<SimpleValue>::isEqual(SimpleValue LHS,
516516
return true;
517517
return false;
518518
};
519-
return LHSI->getKind() == RHSI->getKind() && LHSI->isIdenticalTo(RHSI, opCmp);
519+
bool isEqual =
520+
LHSI->getKind() == RHSI->getKind() && LHSI->isIdenticalTo(RHSI, opCmp);
521+
assert(!isEqual || getHashValue(LHS) == getHashValue(RHS));
522+
return isEqual;
520523
}
521524

522525
namespace {

0 commit comments

Comments
 (0)