summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/Local.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-02-10 07:00:59 +0000
committerDevang Patel <dpatel@apple.com>2009-02-10 07:00:59 +0000
commitcaf4485781dcb2d0ca56b9ab680332df7bd74f2d (patch)
treed82814f0adb17064d1d0a09103d59baefbe5c089 /llvm/lib/Transforms/Utils/Local.cpp
parent7325b61e740af02d72a54467c75cb293fe4ed9af (diff)
downloadbcm5719-llvm-caf4485781dcb2d0ca56b9ab680332df7bd74f2d.tar.gz
bcm5719-llvm-caf4485781dcb2d0ca56b9ab680332df7bd74f2d.zip
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
llvm-svn: 64207
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index c22485342e0..38809e5e1d7 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/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;
+}
OpenPOWER on IntegriCloud