Skip to content

Commit 53dffef

Browse files
committed
SILOptimizer: Fix bad hash calculation in CSE
Fixes rdar://problem/108045677.
1 parent 0ebbb75 commit 53dffef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/SILOptimizer/Transforms/CSE.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ class HashVisitor : public SILInstructionVisitor<HashVisitor, llvm::hash_code> {
523523

524524
hash_code visitDynamicPackIndexInst(DynamicPackIndexInst *X) {
525525
return llvm::hash_combine(
526-
X->getKind(), X->getIndexedPackType(), &X->getOperandRef());
526+
X->getKind(), X->getIndexedPackType(),
527+
tryLookThroughOwnershipInsts(&X->getOperandRef()));
527528
}
528529

529530
hash_code visitTuplePackElementAddrInst(TuplePackElementAddrInst *X) {
@@ -585,7 +586,7 @@ bool llvm::DenseMapInfo<SimpleValue>::isEqual(SimpleValue LHS,
585586
};
586587
bool isEqual =
587588
LHSI->getKind() == RHSI->getKind() && LHSI->isIdenticalTo(RHSI, opCmp);
588-
#ifdef NDEBUG
589+
#ifndef NDEBUG
589590
if (isEqual && getHashValue(LHS) != getHashValue(RHS)) {
590591
llvm::dbgs() << "LHS: ";
591592
LHSI->dump();

0 commit comments

Comments
 (0)