| Index: src/IceCfg.cpp
|
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp
|
| index 1965fe2d5a82fffac65a1ac22d46cb640a10c774..26b8f3fbae1ede8591c91bd880f9d3618a9248aa 100644
|
| --- a/src/IceCfg.cpp
|
| +++ b/src/IceCfg.cpp
|
| @@ -242,6 +242,22 @@ void Cfg::translate() {
|
| getContext()->dumpTimers();
|
| }
|
|
|
| +void Cfg::fixPhiNodes() {
|
| + for (auto *Node : Nodes) {
|
| + // Fix all the phi edges since WASM can't tell how to make them correctly at
|
| + // the beginning.
|
| + assert(Node);
|
| + const auto &InEdges = Node->getInEdges();
|
| + for (auto &Instr : Node->getPhis()) {
|
| + auto *Phi = llvm::cast<InstPhi>(&Instr);
|
| + assert(Phi);
|
| + for (SizeT i = 0; i < InEdges.size(); ++i) {
|
| + Phi->setLabel(i, InEdges[i]);
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| void Cfg::computeInOutEdges() {
|
| // Compute the out-edges.
|
| for (CfgNode *Node : Nodes)
|
| @@ -399,7 +415,7 @@ void Cfg::reorderNodes() {
|
| // in-edge if the predecessor node was contracted). If this changes in
|
| // the future, rethink the strategy.
|
| assert(Node->getInEdges().size() >= 1);
|
| - assert(Node->getOutEdges().size() == 1);
|
| + assert(Node->hasSingleOutEdge());
|
|
|
| // If it's a (non-critical) edge where the successor has a single
|
| // in-edge, then place it before the successor.
|
|
|