fix PR7105 by enumerating MDNodes on all @llvm.foo

function calls, not just recognized intrinsics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103428 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-05-10 20:53:17 +00:00
parent c279243128
commit fd450c026a
2 changed files with 23 additions and 5 deletions

View File

@ -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);

13
test/Feature/metadata.ll Normal file
View File

@ -0,0 +1,13 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis
; PR7105
define void @foo() {
call void @llvm.zonk(metadata !1, i64 0, metadata !1)
ret void
}
declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
!named = !{!0}
!0 = metadata !{i8** null}
!1 = metadata !{i8* null}