summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-09-02 11:13:56 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-09-02 11:13:56 +0000
commit148843b0ce6774866132821e866a5d2669300401 (patch)
treef1266b2e742a9534095b134a0cee3536087a7a2a /lib
parent65c3c8f323198b99b88b109654194540cf9b3fa5 (diff)
downloadllvm-148843b0ce6774866132821e866a5d2669300401.tar.gz
llvm-148843b0ce6774866132821e866a5d2669300401.tar.bz2
llvm-148843b0ce6774866132821e866a5d2669300401.tar.xz
Fix DbgStopPointInst->getFileName/getDirectory, broken by the MDNodification in
r80406, and readd a -print-dbginfo test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/ValueTracking.cpp5
-rw-r--r--lib/VMCore/IntrinsicInst.cpp10
2 files changed, 7 insertions, 8 deletions
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index cb2d624a90..aa71f1dc67 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -1058,6 +1058,11 @@ bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset,
StopAtNul);
}
+ if (MDString *MDStr = dyn_cast<MDString>(V)) {
+ Str = MDStr->getString();
+ return true;
+ }
+
// The GEP instruction, constant or instruction, must reference a global
// variable that is a constant and is initialized. The referenced constant
// initializer is the array that we'll use for optimization.
diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp
index 8bdc96896c..5f33d0eebb 100644
--- a/lib/VMCore/IntrinsicInst.cpp
+++ b/lib/VMCore/IntrinsicInst.cpp
@@ -61,17 +61,11 @@ Value *DbgInfoIntrinsic::StripCast(Value *C) {
Value *DbgStopPointInst::getFileName() const {
// Once the operand indices are verified, update this assert
assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices");
- GlobalVariable *GV = cast<GlobalVariable>(getContext());
- if (!GV->hasInitializer()) return NULL;
- ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
- return CS->getOperand(3);
+ return getContext()->getElement(3);
}
Value *DbgStopPointInst::getDirectory() const {
// Once the operand indices are verified, update this assert
assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices");
- GlobalVariable *GV = cast<GlobalVariable>(getContext());
- if (!GV->hasInitializer()) return NULL;
- ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
- return CS->getOperand(4);
+ return getContext()->getElement(4);
}