diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-06-30 20:14:24 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-06-30 20:14:24 +0000 |
| commit | b10a0f223afbb01df04ef736372e899e8f5edbfe (patch) | |
| tree | adb6f0b518c61335733766b3ac6d62c08d975468 /llvm/lib/VMCore | |
| parent | de68cc91cf0d6f228e4ab0aecc1d0317cbc5a361 (diff) | |
| download | bcm5719-llvm-b10a0f223afbb01df04ef736372e899e8f5edbfe.tar.gz bcm5719-llvm-b10a0f223afbb01df04ef736372e899e8f5edbfe.zip | |
Add r134057 back, but splice the predecessor after the successors phi
nodes.
Original message:
Let simplify cfg simplify bb with only debug and lifetime intrinsics.
llvm-svn: 134182
Diffstat (limited to 'llvm/lib/VMCore')
| -rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 7d470440aff..70265c899d7 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -147,6 +147,26 @@ Instruction* BasicBlock::getFirstNonPHIOrDbg() { return &*i; } +Instruction* BasicBlock::getFirstNonPHIOrDbgOrLifetime() { + // All valid basic blocks should have a terminator, + // which is not a PHINode. If we have an invalid basic + // block we'll get an assertion failure when dereferencing + // a past-the-end iterator. + BasicBlock::iterator i = begin(); + for (;; ++i) { + if (isa<PHINode>(i) || isa<DbgInfoIntrinsic>(i)) + continue; + + const IntrinsicInst *II = dyn_cast<IntrinsicInst>(i); + if (!II) + break; + if (II->getIntrinsicID() != Intrinsic::lifetime_start && + II->getIntrinsicID() != Intrinsic::lifetime_end) + break; + } + return &*i; +} + void BasicBlock::dropAllReferences() { for(iterator I = begin(), E = end(); I != E; ++I) I->dropAllReferences(); |

