Chromium Code Reviews| Index: src/IceCfg.cpp |
| diff --git a/src/IceCfg.cpp b/src/IceCfg.cpp |
| index 8f6a2fffaca0ecbf8d040b895458c0b33bb69895..74430f5969207878597e43d765b80989c74307ba 100644 |
| --- a/src/IceCfg.cpp |
| +++ b/src/IceCfg.cpp |
| @@ -633,6 +633,40 @@ void Cfg::localCSE() { |
| } |
| } |
| +void Cfg::shortCircuitJumps() { |
| + // Split Nodes whenever an early jump is possible. |
| + // __N : |
| + // a = <something> |
| + // Instruction 1 without side effect |
| + // ... b = <something> ... |
| + // Instruction N without side effect |
| + // t1 = or a b |
| + // br t1 __X __Y |
| + // |
| + // is transformed into: |
| + // __N : |
| + // a = <something> |
| + // br a __X __N_ext |
| + // |
| + // __N_ext : |
| + // Instruction 1 without side effect |
| + // ... b = <something> ... |
| + // Instruction N without side effect |
| + // br b __X __Y |
| + //(Similar logic for AND, jump to false instead of true target.) |
| + |
| + TimerMarker T(TimerStack::TT_shortCircuit, this); |
| + getVMetadata()->init(VMK_Uses); |
| + auto Nodes = this->getNodes(); |
|
Jim Stichnoth
2016/06/20 18:41:41
Cfg::getNodes() returns "const NodeList &". So I'
|
| + while (!Nodes.empty()) { |
| + auto Node = Nodes.back(); |
|
John
2016/06/16 13:41:10
auto*
|
| + Nodes.pop_back(); |
| + auto NewNode = Node->shortCircuit(); |
| + if (NewNode) |
| + Nodes.push_back(NewNode); |
|
John
2016/06/16 13:41:10
(I think) You are missing short circuiting opportu
|
| + } |
| +} |
| + |
| void Cfg::doArgLowering() { |
| TimerMarker T(TimerStack::TT_doArgLowering, this); |
| getTarget()->lowerArguments(); |