| OLD | NEW |
| 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// | 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 /// | 9 /// |
| 10 /// \file | 10 /// \file |
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 return; | 845 return; |
| 846 Inst *Branch = nullptr; | 846 Inst *Branch = nullptr; |
| 847 for (Inst &I : Insts) { | 847 for (Inst &I : Insts) { |
| 848 if (I.isDeleted()) | 848 if (I.isDeleted()) |
| 849 continue; | 849 continue; |
| 850 if (I.isUnconditionalBranch()) | 850 if (I.isUnconditionalBranch()) |
| 851 Branch = &I; | 851 Branch = &I; |
| 852 else if (!I.isRedundantAssign()) | 852 else if (!I.isRedundantAssign()) |
| 853 return; | 853 return; |
| 854 } | 854 } |
| 855 // Make sure there is actually a successor to repoint in-edges to. |
| 856 if (OutEdges.empty()) |
| 857 return; |
| 855 assert(OutEdges.size() == 1); | 858 assert(OutEdges.size() == 1); |
| 856 // Don't try to delete a self-loop. | 859 // Don't try to delete a self-loop. |
| 857 if (OutEdges[0] == this) | 860 if (OutEdges[0] == this) |
| 858 return; | 861 return; |
| 862 // Make sure the node actually contains (ends with) an unconditional branch. |
| 863 if (Branch == nullptr) |
| 864 return; |
| 859 | 865 |
| 860 Branch->setDeleted(); | 866 Branch->setDeleted(); |
| 861 CfgNode *Successor = OutEdges.front(); | 867 CfgNode *Successor = OutEdges.front(); |
| 862 // Repoint all this node's in-edges to this node's successor, unless this | 868 // Repoint all this node's in-edges to this node's successor, unless this |
| 863 // node's successor is actually itself (in which case the statement | 869 // node's successor is actually itself (in which case the statement |
| 864 // "OutEdges.front()->InEdges.push_back(Pred)" could invalidate the iterator | 870 // "OutEdges.front()->InEdges.push_back(Pred)" could invalidate the iterator |
| 865 // over this->InEdges). | 871 // over this->InEdges). |
| 866 if (Successor != this) { | 872 if (Successor != this) { |
| 867 for (CfgNode *Pred : InEdges) { | 873 for (CfgNode *Pred : InEdges) { |
| 868 for (CfgNode *&I : Pred->OutEdges) { | 874 for (CfgNode *&I : Pred->OutEdges) { |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 auto *Inst = InstIntrinsicCall::create( | 1432 auto *Inst = InstIntrinsicCall::create( |
| 1427 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1433 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
| 1428 Inst->addArg(AtomicRMWOp); | 1434 Inst->addArg(AtomicRMWOp); |
| 1429 Inst->addArg(Counter); | 1435 Inst->addArg(Counter); |
| 1430 Inst->addArg(One); | 1436 Inst->addArg(One); |
| 1431 Inst->addArg(OrderAcquireRelease); | 1437 Inst->addArg(OrderAcquireRelease); |
| 1432 Insts.push_front(Inst); | 1438 Insts.push_front(Inst); |
| 1433 } | 1439 } |
| 1434 | 1440 |
| 1435 } // end of namespace Ice | 1441 } // end of namespace Ice |
| OLD | NEW |