| 5 | namespace ftg { |
| 6 | |
| 7 | ICmpInst *getLoopExitCond(Loop &L) { |
| 8 | BranchInst *BI = nullptr; |
| 9 | if (L.isRotatedForm()) { |
| 10 | auto LL = L.getLoopLatch(); |
| 11 | assert(LL && "Unexpected Program State"); |
| 12 | |
| 13 | BI = dyn_cast<BranchInst>(LL->getTerminator()); |
| 14 | } else { |
| 15 | auto Header = L.getHeader(); |
| 16 | assert(Header && "Unexpected Program State"); |
| 17 | |
| 18 | BI = dyn_cast<BranchInst>(Header->getTerminator()); |
| 19 | } |
| 20 | |
| 21 | if (BI && BI->isConditional()) { |
| 22 | assert((BI->getSuccessor(0) != BI->getSuccessor(1)) && |
| 23 | "Both outgoing branches should not target same header!"); |
| 24 | return dyn_cast<ICmpInst>(BI->getCondition()); |
| 25 | } |
| 26 | |
| 27 | return nullptr; |
| 28 | } |
| 29 | |
| 30 | } // namespace ftg |
no outgoing calls
no test coverage detected