aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2010-01-29 21:19:19 +0000
committerVictor Hernandez <vhernandez@apple.com>2010-01-29 21:19:19 +0000
commit2c482f4895f146cd5b61a42750c4070a8fff3a38 (patch)
tree2515b55669aa633c03e31497b32d23591d736a56 /lib/Bitcode
parent36664bfc7a540f1b45e80c966e36b1aea9d29aa3 (diff)
downloadexternal_llvm-2c482f4895f146cd5b61a42750c4070a8fff3a38.zip
external_llvm-2c482f4895f146cd5b61a42750c4070a8fff3a38.tar.gz
external_llvm-2c482f4895f146cd5b61a42750c4070a8fff3a38.tar.bz2
We were not writing bitcode for function-local metadata whose operands have been erased (making it not have any more function-local operands)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94842 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Writer/BitcodeWriter.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp
index 54f756f..a5bb526 100644
--- a/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -498,7 +498,7 @@ static void WriteModuleMetadata(const ValueEnumerator &VE,
for (unsigned i = 0, e = Vals.size(); i != e; ++i) {
if (const MDNode *N = dyn_cast<MDNode>(Vals[i].first)) {
- if (!N->isFunctionLocal()) {
+ if (!N->isFunctionLocal() || !N->getFunction()) {
if (!StartedMetadataBlock) {
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
StartedMetadataBlock = true;
@@ -562,7 +562,7 @@ static void WriteFunctionLocalMetadata(const Function &F,
for (unsigned i = 0, e = Vals.size(); i != e; ++i)
if (const MDNode *N = dyn_cast<MDNode>(Vals[i].first))
- if (N->getFunction() == &F) {
+ if (N->isFunctionLocal() && N->getFunction() == &F) {
if (!StartedMetadataBlock) {
Stream.EnterSubblock(bitc::METADATA_BLOCK_ID, 3);
StartedMetadataBlock = true;