diff options
author | Devang Patel <dpatel@apple.com> | 2009-02-10 07:00:59 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-02-10 07:00:59 +0000 |
commit | 4afc90dacf309999d8b7f6c2b4b0c56af346bab5 (patch) | |
tree | d6324836dd059b615659328eceaf1bd1bd137349 /lib/Transforms/Utils/Local.cpp | |
parent | 2303df96b05077b085db64274cd0e3ade452e715 (diff) |
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | lib/Transforms/Utils/Local.cpp | 22 |
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; +} |