@@ -134,51 +134,20 @@ struct TransferringOperand {
134
134
<< " User: " << *getUser ();
135
135
}
136
136
137
- SWIFT_DEBUG_DUMP { print (llvm::dbgs ()); }
138
- };
139
-
140
- } // namespace swift
141
-
142
- namespace llvm {
143
-
144
- template <>
145
- struct PointerLikeTypeTraits <swift::TransferringOperand> {
146
- using TransferringOperand = swift::TransferringOperand;
147
-
148
- static inline void *getAsVoidPointer (TransferringOperand ptr) {
149
- return PointerLikeTypeTraits<
150
- TransferringOperand::ValueType>::getAsVoidPointer (ptr.value );
151
- }
152
- static inline TransferringOperand getFromVoidPointer (void *ptr) {
153
- return {PointerLikeTypeTraits<
154
- TransferringOperand::ValueType>::getFromVoidPointer (ptr)};
137
+ static void Profile (llvm::FoldingSetNodeID &id, Operand *op,
138
+ bool isClosureCaptured) {
139
+ id.AddPointer (op);
140
+ id.AddBoolean (isClosureCaptured);
155
141
}
156
142
157
- static constexpr int NumLowBitsAvailable = PointerLikeTypeTraits<
158
- TransferringOperand::ValueType>::NumLowBitsAvailable;
159
- };
160
-
161
- template <>
162
- struct DenseMapInfo <swift::TransferringOperand> {
163
- using TransferringOperand = swift::TransferringOperand;
164
- using ParentInfo = DenseMapInfo<TransferringOperand::ValueType>;
165
-
166
- static TransferringOperand getEmptyKey () {
167
- return TransferringOperand (ParentInfo::getEmptyKey ());
168
- }
169
- static TransferringOperand getTombstoneKey () {
170
- return TransferringOperand (ParentInfo::getTombstoneKey ());
143
+ void Profile (llvm::FoldingSetNodeID &id) const {
144
+ Profile (id, getOperand (), isClosureCaptured ());
171
145
}
172
146
173
- static unsigned getHashValue (TransferringOperand operand) {
174
- return ParentInfo::getHashValue (operand.value );
175
- }
176
- static bool isEqual (TransferringOperand LHS, TransferringOperand RHS) {
177
- return ParentInfo::isEqual (LHS.value , RHS.value );
178
- }
147
+ SWIFT_DEBUG_DUMP { print (llvm::dbgs ()); }
179
148
};
180
149
181
- } // namespace llvm
150
+ } // namespace swift
182
151
183
152
namespace swift {
184
153
@@ -371,9 +340,9 @@ class Partition {
371
340
372
341
using Element = PartitionPrimitives::Element;
373
342
using Region = PartitionPrimitives::Region;
374
- using TransferringOperandSet = ImmutablePointerSet<TransferringOperand>;
343
+ using TransferringOperandSet = ImmutablePointerSet<TransferringOperand * >;
375
344
using TransferringOperandSetFactory =
376
- ImmutablePointerSetFactory<TransferringOperand>;
345
+ ImmutablePointerSetFactory<TransferringOperand * >;
377
346
378
347
private:
379
348
// / A map from a region number to a instruction that consumes it.
@@ -721,8 +690,8 @@ class Partition {
721
690
bool isClosureCaptured = false ;
722
691
if (isTransferred) {
723
692
isClosureCaptured = llvm::any_of (
724
- iter->getSecond ()->range (), [](const TransferringOperand & operand) {
725
- return operand. isClosureCaptured ();
693
+ iter->getSecond ()->range (), [](const TransferringOperand * operand) {
694
+ return operand-> isClosureCaptured ();
726
695
});
727
696
}
728
697
@@ -765,8 +734,8 @@ class Partition {
765
734
bool isClosureCaptured = false ;
766
735
if (isTransferred) {
767
736
isClosureCaptured = llvm::any_of (
768
- iter->getSecond ()->range (), [](const TransferringOperand & operand) {
769
- return operand. isClosureCaptured ();
737
+ iter->getSecond ()->range (), [](const TransferringOperand * operand) {
738
+ return operand-> isClosureCaptured ();
770
739
});
771
740
}
772
741
@@ -795,7 +764,7 @@ class Partition {
795
764
if (isTransferred) {
796
765
for (auto op : iter->getSecond ()->data ()) {
797
766
os << " " ;
798
- op. print (os);
767
+ op-> print (os);
799
768
}
800
769
} else {
801
770
os << " None.\n " ;
@@ -1208,7 +1177,7 @@ struct PartitionOpEvaluator {
1208
1177
1209
1178
// / Call handleLocalUseAfterTransfer on our CRTP subclass.
1210
1179
void handleLocalUseAfterTransfer (const PartitionOp &op, Element elt,
1211
- TransferringOperand transferringOp) const {
1180
+ TransferringOperand * transferringOp) const {
1212
1181
return asImpl ().handleLocalUseAfterTransfer (op, elt, transferringOp);
1213
1182
}
1214
1183
@@ -1326,9 +1295,9 @@ struct PartitionOpEvaluator {
1326
1295
}
1327
1296
1328
1297
// Mark op.getOpArgs()[0] as transferred.
1329
- p. markTransferred (
1330
- op.getOpArgs ()[ 0 ],
1331
- ptrSetFactory. get ({ op.getSourceOp (), isClosureCapturedElt}) );
1298
+ auto *ptrSet =
1299
+ ptrSetFactory. emplace ( op.getSourceOp (), isClosureCapturedElt);
1300
+ p. markTransferred ( op.getOpArgs ()[ 0 ], ptrSet );
1332
1301
return ;
1333
1302
}
1334
1303
case PartitionOpKind::UndoTransfer: {
@@ -1419,7 +1388,7 @@ struct PartitionOpEvaluatorBaseImpl : PartitionOpEvaluator<Subclass> {
1419
1388
// / region. Can be used to get the immediate value transferred or the
1420
1389
// / transferring instruction.
1421
1390
void handleLocalUseAfterTransfer (const PartitionOp &op, Element elt,
1422
- TransferringOperand transferringOp) const {}
1391
+ TransferringOperand * transferringOp) const {}
1423
1392
1424
1393
// / This is called if we detect a never transferred element that was passed to
1425
1394
// / a transfer instruction.
0 commit comments