@@ -336,11 +336,11 @@ std::pair<const CGNode *, unsigned> EscapeAnalysis::CGNode::getRepNode(
336
336
return {this , 0 };
337
337
338
338
for (Predecessor pred : Preds) {
339
- if (pred.getInt () != EdgeType::PointsTo)
339
+ if (! pred.is ( EdgeType::PointsTo) )
340
340
continue ;
341
- if (!visited.insert (pred.getPointer ()).second )
341
+ if (!visited.insert (pred.getPredNode ()).second )
342
342
continue ;
343
- auto repNodeAndDepth = pred.getPointer ()->getRepNode (visited);
343
+ auto repNodeAndDepth = pred.getPredNode ()->getRepNode (visited);
344
344
if (repNodeAndDepth.first )
345
345
return {repNodeAndDepth.first , repNodeAndDepth.second + 1 };
346
346
// If a representative node was not found on this pointsTo node, recursion
@@ -390,9 +390,9 @@ bool EscapeAnalysis::CGNode::visitSuccessors(Visitor &&visitor) const {
390
390
template <typename Visitor>
391
391
bool EscapeAnalysis::CGNode::visitDefers (Visitor &&visitor) const {
392
392
for (Predecessor pred : Preds) {
393
- if (pred.getInt () != EdgeType::Defer)
393
+ if (! pred.is ( EdgeType::Defer) )
394
394
continue ;
395
- if (!visitor (pred.getPointer (), false ))
395
+ if (!visitor (pred.getPredNode (), false ))
396
396
return false ;
397
397
}
398
398
for (auto *deferred : defersTo) {
@@ -549,10 +549,10 @@ void EscapeAnalysis::ConnectionGraph::initializePointsTo(CGNode *initialNode,
549
549
// distinguish these cases, always retry backward traversal--it just won't
550
550
// revisit any edges in the later case.
551
551
backwardTraverse (edgeNode, [&](Predecessor pred) {
552
- if (pred.getInt () != EdgeType::Defer)
552
+ if (! pred.is ( EdgeType::Defer) )
553
553
return Traversal::Backtrack;
554
554
555
- CGNode *predNode = pred.getPointer ();
555
+ CGNode *predNode = pred.getPredNode ();
556
556
if (predNode->pointsTo ) {
557
557
assert (predNode->pointsTo ->getMergeTarget () == newPointsTo);
558
558
return Traversal::Backtrack;
@@ -608,8 +608,8 @@ void EscapeAnalysis::ConnectionGraph::mergeAllScheduledNodes() {
608
608
// initializePointsTo(). By ensuring that 'From' is unreachable first, the
609
609
// graph appears consistent during those operations.
610
610
for (Predecessor Pred : From->Preds ) {
611
- CGNode *PredNode = Pred.getPointer ();
612
- if (Pred.getInt () == EdgeType::PointsTo) {
611
+ CGNode *PredNode = Pred.getPredNode ();
612
+ if (Pred.is ( EdgeType::PointsTo) ) {
613
613
assert (PredNode->getPointsToEdge () == From
614
614
&& " Incoming pointsTo edge not set in predecessor" );
615
615
if (PredNode != From)
@@ -715,13 +715,13 @@ void EscapeAnalysis::ConnectionGraph::mergeAllScheduledNodes() {
715
715
// pointsTo predecessors (which are now attached to 'To').
716
716
for (unsigned PredIdx = 0 ; PredIdx < To->Preds .size (); ++PredIdx) {
717
717
auto predEdge = To->Preds [PredIdx];
718
- if (predEdge.getInt () != EdgeType::PointsTo)
718
+ if (! predEdge.is ( EdgeType::PointsTo) )
719
719
continue ;
720
- predEdge.getPointer ()->visitDefers (
721
- [&](CGNode *deferred, bool /* isSucc*/ ) {
722
- mergePointsTo (deferred, To);
723
- return true ;
724
- });
720
+ predEdge.getPredNode ()->visitDefers (
721
+ [&](CGNode *deferred, bool /* isSucc*/ ) {
722
+ mergePointsTo (deferred, To);
723
+ return true ;
724
+ });
725
725
}
726
726
To->mergeEscapeState (From->State );
727
727
@@ -1024,7 +1024,7 @@ bool EscapeAnalysis::ConnectionGraph::backwardTraverse(
1024
1024
for (Predecessor pred : reachingNode->Preds ) {
1025
1025
switch (visitor (pred)) {
1026
1026
case Traversal::Follow: {
1027
- CGNode *predNode = pred.getPointer ();
1027
+ CGNode *predNode = pred.getPredNode ();
1028
1028
worklist.tryPush (predNode);
1029
1029
break ;
1030
1030
}
@@ -1073,7 +1073,7 @@ bool EscapeAnalysis::ConnectionGraph::mayReach(CGNode *pointer,
1073
1073
1074
1074
// This query is successful when the traversal halts and returns false.
1075
1075
return !backwardTraverse (pointee, [pointer](Predecessor pred) {
1076
- if (pred.getPointer () == pointer)
1076
+ if (pred.getPredNode () == pointer)
1077
1077
return Traversal::Halt;
1078
1078
return Traversal::Follow;
1079
1079
});
@@ -1177,8 +1177,6 @@ std::string CGForDotView::getNodeLabel(const Node *Node) const {
1177
1177
std::string Label;
1178
1178
llvm::raw_string_ostream O (Label);
1179
1179
Node->OrigNode ->getRepValue ().print (O, InstToIDMap);
1180
- if (Node->OrigNode ->Type == EscapeAnalysis::NodeType::Return)
1181
- O << " return" ;
1182
1180
O << ' \n ' ;
1183
1181
if (Node->OrigNode ->mappedValue ) {
1184
1182
std::string Inst;
@@ -1503,11 +1501,11 @@ void EscapeAnalysis::ConnectionGraph::verifyStructure(bool allowMerge) const {
1503
1501
}
1504
1502
// Check if predecessor and successor edges are linked correctly.
1505
1503
for (Predecessor Pred : Nd->Preds ) {
1506
- CGNode *PredNode = Pred.getPointer ();
1507
- if (Pred.getInt () == EdgeType::Defer) {
1504
+ CGNode *PredNode = Pred.getPredNode ();
1505
+ if (Pred.is ( EdgeType::Defer) ) {
1508
1506
assert (PredNode->findDeferred (Nd) != PredNode->defersTo .end ());
1509
1507
} else {
1510
- assert (Pred.getInt () == EdgeType::PointsTo);
1508
+ assert (Pred.is ( EdgeType::PointsTo) );
1511
1509
assert (PredNode->getPointsToEdge () == Nd);
1512
1510
}
1513
1511
}
@@ -2349,7 +2347,7 @@ bool EscapeAnalysis::canEscapeToUsePoint(SILValue V, SILNode *UsePoint,
2349
2347
2350
2348
// First check if there are escape paths which we don't explicitly see
2351
2349
// in the graph.
2352
- if (Node->escapesInsideFunction (V))
2350
+ if (Node->valueEscapesInsideFunction (V))
2353
2351
return true ;
2354
2352
2355
2353
// No hidden escapes: check if the Node is reachable from the UsePoint.
@@ -2369,7 +2367,7 @@ bool EscapeAnalysis::canEscapeToUsePoint(SILValue V, SILNode *UsePoint,
2369
2367
// As V1's content node is the same as V's content node, we also make the
2370
2368
// check for the content node.
2371
2369
CGNode *ContentNode = getValueContent (ConGraph, V);
2372
- if (ContentNode->escapesInsideFunction (V))
2370
+ if (ContentNode->valueEscapesInsideFunction (V))
2373
2371
return true ;
2374
2372
2375
2373
if (ConGraph->isUsePoint (UsePoint, ContentNode))
@@ -2450,10 +2448,10 @@ bool EscapeAnalysis::canPointToSameMemory(SILValue V1, SILValue V2) {
2450
2448
return true ;
2451
2449
2452
2450
// Finish the check for one value being a non-escaping local object.
2453
- if (isUniq1 && Node1->escapesInsideFunction (V1))
2451
+ if (isUniq1 && Node1->valueEscapesInsideFunction (V1))
2454
2452
isUniq1 = false ;
2455
2453
2456
- if (isUniq2 && Node2->escapesInsideFunction (V2))
2454
+ if (isUniq2 && Node2->valueEscapesInsideFunction (V2))
2457
2455
isUniq2 = false ;
2458
2456
2459
2457
if (!isUniq1 && !isUniq2)
0 commit comments