aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r--lib/Transforms/Utils/Local.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp
index c22485342e..38809e5e1d 100644
--- a/lib/Transforms/Utils/Local.cpp
+++ b/lib/Transforms/Utils/Local.cpp
@@ -248,3 +248,25 @@ void llvm::MergeBasicBlockIntoOnlyPred(BasicBlock *DestBB) {
// Nuke BB.
PredBB->eraseFromParent();
}
+
+/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
+/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled
+/// with the DbgInfoIntrinsic that use the instruction I.
+bool llvm::OnlyUsedByDbgInfoIntrinsics(Instruction *I,
+ SmallVectorImpl<DbgInfoIntrinsic *> *DbgInUses) {
+ if (DbgInUses)
+ DbgInUses->clear();
+
+ for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
+ ++UI) {
+ if (DbgInfoIntrinsic *DI = dyn_cast<DbgInfoIntrinsic>(*UI)) {
+ if (DbgInUses)
+ DbgInUses->push_back(DI);
+ } else {
+ if (DbgInUses)
+ DbgInUses->clear();
+ return false;
+ }
+ }
+ return true;
+}