llvm.org GIT mirror llvm / 7305c55
fix rdar://9776316 - type remapping needed for inline asm blobs, fixing some objc llvm-test crashes with LTO. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135324 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
2 changed file(s) with 34 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
1414 #include "llvm/Transforms/Utils/ValueMapper.h"
1515 #include "llvm/Constants.h"
1616 #include "llvm/Function.h"
17 #include "llvm/InlineAsm.h"
1718 #include "llvm/Instructions.h"
1819 #include "llvm/Metadata.h"
1920 using namespace llvm;
3031
3132 // Global values do not need to be seeded into the VM if they
3233 // are using the identity mapping.
33 if (isa(V) || isa<InlineAsm>(V) || isa<MDString>(V))
34 if (isa(V) || isa<MDString>(V))
3435 return VM[V] = const_cast(V);
36
37 if (const InlineAsm *IA = dyn_cast(V)) {
38 // Inline asm may need *type* remapping.
39 FunctionType *NewTy = IA->getFunctionType();
40 if (TypeMapper) {
41 NewTy = cast(TypeMapper->remapType(NewTy));
42
43 if (NewTy != IA->getFunctionType())
44 V = InlineAsm::get(NewTy, IA->getAsmString(), IA->getConstraintString(),
45 IA->hasSideEffects(), IA->isAlignStack());
46 }
47
48 return VM[V] = const_cast(V);
49 }
50
3551
3652 if (const MDNode *MD = dyn_cast(V)) {
3753 // If this is a module-level metadata and we know that nothing at the module
0 ; RUN: echo > %t.ll
1 ; RUN: llvm-link %t.ll %s -S
2
3 ; ModuleID = 'bitfield-access-2.o'
4 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
5 target triple = "i386-apple-macosx10.6.8"
6
7 ; rdar://9776316 - type remapping needed for inline asm blobs.
8
9 %T = type { [18 x i32], [4 x i8*] }
10
11 define void @f(%T* %x) nounwind ssp {
12 entry:
13 call void asm sideeffect "", "=*m"(%T* %x) nounwind
14 unreachable
15 }
16