llvm.org GIT mirror llvm / 8676f81
Merge r287453 in 3.9.1 : [ThinLTO] Fix crash when importing an opaque type See: http://llvm.org/PR31072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@287805 91177308-0d34-0410-b5e6-96231b3b80d8 Mehdi Amini 2 years ago
3 changed file(s) with 43 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
13351335
13361336 IRMover::IRMover(Module &M) : Composite(M) {
13371337 TypeFinder StructTypes;
1338 StructTypes.run(M, true);
1338 StructTypes.run(M, /* OnlyNamed */ false);
13391339 for (StructType *Ty : StructTypes) {
13401340 if (Ty->isOpaque())
13411341 IdentifiedStructTypes.addOpaque(Ty);
0 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
1 target triple = "x86_64-apple-macosx10.11.0"
2
3 %0 = type { i8 }
4
5 %a = type { %0 * }
6
7 define void @bar(%a *) {
8 ret void
9 }
10
11 define void @baz() {
12 call void @bar(%a *null)
13 ret void
14 }
0 ; Do setup work for all below tests: generate bitcode and combined index
1 ; RUN: opt -module-summary %s -o %t.bc
2 ; RUN: opt -module-summary %p/Inputs/import_opaque_type.ll -o %t2.bc
3 ; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc
4
5 ; Check that we import correctly the imported type to replace the opaque one here
6 ; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s
7
8
9 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-apple-macosx10.11.0"
11
12 ; CHECK: %0 = type { i8 }
13 %0 = type opaque
14
15 %a = type { %0 * }
16
17 declare void @baz()
18 define void @foo(%a *) {
19 call void @baz()
20 ret void
21 }
22
23 define i32 @main() {
24 call void @foo(%a *null)
25 ret i32 0
26 }