llvm.org GIT mirror llvm / fd450c0
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 Chris Lattner 10 years ago
2 changed file(s) with 23 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
676676 if (!I->getType()->isVoidTy() && !I->hasName())
677677 CreateFunctionSlot(I);
678678
679 // Intrinsics can directly use metadata.
680 if (isa(I))
681 for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
682 if (MDNode *N = dyn_cast_or_null(I->getOperand(i)))
683 CreateMetadataSlot(N);
679 // Intrinsics can directly use metadata. We allow direct calls to any
680 // llvm.foo function here, because the target may not be linked into the
681 // optimizer.
682 if (const CallInst *CI = dyn_cast(I)) {
683 if (Function *F = CI->getCalledFunction())
684 if (F->getName().startswith("llvm."))
685 for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
686 if (MDNode *N = dyn_cast_or_null(I->getOperand(i)))
687 CreateMetadataSlot(N);
688 }
684689
685690 // Process metadata attached with this instruction.
686691 I->getAllMetadata(MDForInst);
0 ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis
1 ; PR7105
2
3 define void @foo() {
4 call void @llvm.zonk(metadata !1, i64 0, metadata !1)
5 ret void
6 }
7
8 declare void @llvm.zonk(metadata, i64, metadata) nounwind readnone
9
10 !named = !{!0}
11 !0 = metadata !{i8** null}
12 !1 = metadata !{i8* null}