llvm.org GIT mirror llvm / ae709ea
Link metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78652 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 11 years ago
3 changed file(s) with 32 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
394394 assert(!isa(CPV) && "Unmapped global?");
395395 llvm_unreachable("Unknown type of derived type constant value!");
396396 }
397 } else if (const MDNode *N = dyn_cast(In)) {
398 std::vector Elems;
399 for (unsigned i = 0, e = N->getNumElements(); i !=e; ++i)
400 Elems.push_back(RemapOperand(N->getElement(i), ValueMap, Context));
401 if (!Elems.empty())
402 Result = MDNode::get(Context, &Elems[0], Elems.size());
403 } else if (const MDString *MDS = dyn_cast(In)) {
404 Result = MDString::get(Context, MDS->getString());
397405 } else if (isa(In)) {
398406 Result = const_cast(In);
399407 }
0 ; RUN: llvm-as < %s > %t.bc
1 ; RUN: llvm-as < %p/linkmdnode2.ll > %t2.bc
2 ; RUN: llvm-link %t.bc %t2.bc
3
4
5 !21 = metadata !{i32 42, metadata !"foobar"}
6
7 declare i8 @llvm.something(metadata %a)
8 define void @foo() {
9 %x = call i8 @llvm.something(metadata !21)
10 ret void
11 }
0 ; This file is used by linkmdnode.ll, so it doesn't actually do anything itself
1 ;
2 ; RUN: true
3
4 !22 = metadata !{i32 42, metadata !"foobar"}
5
6 declare i8 @llvm.something(metadata %a)
7 define void @foo1() {
8 ;; Intrinsic using MDNode and MDString
9 %x = call i8 @llvm.something(metadata !22)
10 ret void
11 }