diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-10 20:53:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-10 20:53:17 +0000 |
commit | 58aff8fb5784e0bb9792d595650b2812121f2422 (patch) | |
tree | dfe0782cf58d0c41e1b54e4447d048670c72e46f /llvm/lib/VMCore/AsmWriter.cpp | |
parent | 05b4caff3e6f8e6b64fa5196b3c1d778cb7dbe2e (diff) | |
download | bcm5719-llvm-58aff8fb5784e0bb9792d595650b2812121f2422.tar.gz bcm5719-llvm-58aff8fb5784e0bb9792d595650b2812121f2422.zip |
fix PR7105 by enumerating MDNodes on all @llvm.foo
function calls, not just recognized intrinsics.
llvm-svn: 103428
Diffstat (limited to 'llvm/lib/VMCore/AsmWriter.cpp')
-rw-r--r-- | llvm/lib/VMCore/AsmWriter.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/AsmWriter.cpp b/llvm/lib/VMCore/AsmWriter.cpp index fc845c14e88..4e8938f7b75 100644 --- a/llvm/lib/VMCore/AsmWriter.cpp +++ b/llvm/lib/VMCore/AsmWriter.cpp @@ -677,11 +677,16 @@ void SlotTracker::processFunction() { if (!I->getType()->isVoidTy() && !I->hasName()) CreateFunctionSlot(I); - // Intrinsics can directly use metadata. - if (isa<IntrinsicInst>(I)) - for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) - if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i))) - CreateMetadataSlot(N); + // Intrinsics can directly use metadata. We allow direct calls to any + // llvm.foo function here, because the target may not be linked into the + // optimizer. + if (const CallInst *CI = dyn_cast<CallInst>(I)) { + if (Function *F = CI->getCalledFunction()) + if (F->getName().startswith("llvm.")) + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (MDNode *N = dyn_cast_or_null<MDNode>(I->getOperand(i))) + CreateMetadataSlot(N); + } // Process metadata attached with this instruction. I->getAllMetadata(MDForInst); |