diff options
author | ed <ed@FreeBSD.org> | 2009-06-27 10:44:33 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-27 10:44:33 +0000 |
commit | cf5cd875b51255602afaed29deb636b66b295671 (patch) | |
tree | 9794dc36f22f2a2b3f8063829d8a9b3a7794acc8 /lib/Transforms/Utils/Local.cpp | |
parent | 5c1b5c146f3df07c75174aff06c3bb0968f6857e (diff) | |
download | FreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.zip FreeBSD-src-cf5cd875b51255602afaed29deb636b66b295671.tar.gz |
Import LLVM r74383.
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | lib/Transforms/Utils/Local.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index c7fff54..8c08638 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -340,44 +340,3 @@ bool llvm::OnlyUsedByDbgInfoIntrinsics(Instruction *I, return true; } -/// UserIsDebugInfo - Return true if U is a constant expr used by -/// llvm.dbg.variable or llvm.dbg.global_variable -bool llvm::UserIsDebugInfo(User *U) { - ConstantExpr *CE = dyn_cast<ConstantExpr>(U); - - if (!CE || CE->getNumUses() != 1) - return false; - - Constant *Init = dyn_cast<Constant>(CE->use_back()); - if (!Init || Init->getNumUses() != 1) - return false; - - GlobalVariable *GV = dyn_cast<GlobalVariable>(Init->use_back()); - if (!GV || !GV->hasInitializer() || GV->getInitializer() != Init) - return false; - - DIVariable DV(GV); - if (!DV.isNull()) - return true; // User is llvm.dbg.variable - - DIGlobalVariable DGV(GV); - if (!DGV.isNull()) - return true; // User is llvm.dbg.global_variable - - return false; -} - -/// RemoveDbgInfoUser - Remove an User which is representing debug info. -void llvm::RemoveDbgInfoUser(User *U) { - assert (UserIsDebugInfo(U) && "Unexpected User!"); - ConstantExpr *CE = cast<ConstantExpr>(U); - while (!CE->use_empty()) { - Constant *C = cast<Constant>(CE->use_back()); - while (!C->use_empty()) { - GlobalVariable *GV = cast<GlobalVariable>(C->use_back()); - GV->eraseFromParent(); - } - C->destroyConstant(); - } - CE->destroyConstant(); -} |