File tree Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Expand file tree Collapse file tree 3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -952,6 +952,7 @@ void llvm::thinLTOResolvePrevailingInModule(
952
952
if (NewLinkage == GV.getLinkage ())
953
953
return ;
954
954
if (GlobalValue::isLocalLinkage (GV.getLinkage ()) ||
955
+ GlobalValue::isLocalLinkage (NewLinkage) ||
955
956
// In case it was dead and already converted to declaration.
956
957
GV.isDeclaration ())
957
958
return ;
Original file line number Diff line number Diff line change
1
+ ; ModuleID = 'test.c'
2
+ source_filename = "test.c"
3
+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4
+ target triple = "x86_64-unknown-linux-gnu"
5
+
6
+ ; RUN: opt -module-summary %s -o %t.bc
7
+ ; RUN: llvm-lto2 run -save-temps %t.bc -o %t.out \
8
+ ; RUN: -r=%t.bc,foo,plx \
9
+ ; RUN: -r=%t.bc,bar,lx
10
+
11
+ ; Check that we don't internalize `bar` during promotion,
12
+ ; because foo and bar are members of the same comdat
13
+ ; RUN: llvm-dis %t.out.1.1.promote.bc -o - | FileCheck %s
14
+
15
+ ; Thin LTO internalization shouldn't internalize `bar` as well
16
+ ; RUN: llvm-dis %t.out.1.2.internalize.bc -o - | FileCheck %s
17
+
18
+ ; CHECK: define linkonce_odr dso_local i32 @bar() comdat($foo)
19
+
20
+ $foo = comdat any
21
+
22
+ ; Function Attrs: noinline nounwind optnone uwtable
23
+ define linkonce_odr dso_local i32 @bar () comdat($foo) {
24
+ entry:
25
+ ret i32 33
26
+ }
27
+
28
+ ; Function Attrs: noinline nounwind optnone uwtable
29
+ define linkonce_odr dso_local i32 @foo () comdat {
30
+ entry:
31
+ %call = call i32 @bar ()
32
+ %add = add nsw i32 42 , %call
33
+ ret i32 %add
34
+ }
Original file line number Diff line number Diff line change 7
7
; RUN: -r=%t.bc,_ZZN9SingletonI1SE11getInstanceEvE8instance,lx \
8
8
; RUN: -r=%t.bc,_ZZN9SingletonI1SE11getInstanceEvE13instance_weak,lx
9
9
; RUN: llvm-dis %t.out.1.1.promote.bc -o - | FileCheck %s
10
+ ; RUN: llvm-dis %t.out.1.2.internalize.bc -o - | FileCheck %s --check-prefix=INTERNALIZE
10
11
11
12
; CHECK: @_ZZN9SingletonI1SE11getInstanceEvE8instance = available_externally dso_local global %struct.S zeroinitializer
12
13
; CHECK: @_ZZN9SingletonI1SE11getInstanceEvE13instance_weak = available_externally dso_local global %struct.S* null, align 8
13
- ; CHECK: define internal dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv() comdat
14
+ ; CHECK: define linkonce_odr dso_local dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv() comdat
15
+ ; INTERNALIZE: define internal dereferenceable(16) %struct.S* @_ZN9SingletonI1SE11getInstanceEv()
14
16
15
17
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
16
18
target triple = "x86_64-unknown-linux-gnu"
You can’t perform that action at this time.
0 commit comments