Skip to content

Commit 3361aff

Browse files
authored
Merge pull request #35254 from meg-gupta/csefix1
[NFC] Simplify DenseMapInfo<SimpleValue>::isEqual in CSE
2 parents 126f1ac + badf0c1 commit 3361aff

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

lib/SILOptimizer/Transforms/CSE.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -510,20 +510,7 @@ bool llvm::DenseMapInfo<SimpleValue>::isEqual(SimpleValue LHS,
510510
return true;
511511
return false;
512512
};
513-
auto canHandleOwnershipConversion = [](const SILInstruction *lhs,
514-
const SILInstruction *rhs) -> bool {
515-
if (!lhs->getFunction()->hasOwnership())
516-
return true;
517-
// TODO: Support MultipleValueInstructionResult in OSSA RAUW utility and
518-
// extend it here as well
519-
if (!isa<SingleValueInstruction>(lhs))
520-
return false;
521-
return OwnershipFixupContext::canFixUpOwnershipForRAUW(
522-
cast<SingleValueInstruction>(lhs), cast<SingleValueInstruction>(rhs));
523-
};
524-
return LHSI->getKind() == RHSI->getKind() &&
525-
LHSI->isIdenticalTo(RHSI, opCmp) &&
526-
(LHSI == RHSI || canHandleOwnershipConversion(LHSI, RHSI));
513+
return LHSI->getKind() == RHSI->getKind() && LHSI->isIdenticalTo(RHSI, opCmp);
527514
}
528515

529516
namespace {
@@ -1032,9 +1019,15 @@ bool CSE::processNode(DominanceInfoNode *Node) {
10321019
++NumCSE;
10331020
continue;
10341021
}
1035-
// Replace SingleValueInstruction using OSSA RAUW here
10361022
// TODO: Support MultipleValueInstructionResult in OSSA RAUW utility and
10371023
// extend it here as well
1024+
if (!isa<SingleValueInstruction>(Inst))
1025+
continue;
1026+
if (!OwnershipFixupContext::canFixUpOwnershipForRAUW(
1027+
cast<SingleValueInstruction>(Inst),
1028+
cast<SingleValueInstruction>(AvailInst)))
1029+
continue;
1030+
// Replace SingleValueInstruction using OSSA RAUW here
10381031
nextI = FixupCtx.replaceAllUsesAndEraseFixingOwnership(
10391032
cast<SingleValueInstruction>(Inst),
10401033
cast<SingleValueInstruction>(AvailInst));

0 commit comments

Comments
 (0)