File tree Expand file tree Collapse file tree 2 files changed +6
-37
lines changed Expand file tree Collapse file tree 2 files changed +6
-37
lines changed Original file line number Diff line number Diff line change @@ -51,20 +51,9 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const {
51
51
52
52
auto *GV = dyn_cast<GlobalVariable>(GO);
53
53
54
- auto IsPrefix = [](StringRef Name, StringRef Prefix) {
55
- return Name.consume_front (Prefix) && (Name.empty () || Name[0 ] == ' .' );
56
- };
57
-
58
54
// Functions/GlobalIFuncs are only large under the large code model.
59
- if (!GV) {
60
- // Handle explicit sections as we do for GlobalVariables with an explicit
61
- // section, see comments below.
62
- if (GO->hasSection ()) {
63
- StringRef Name = GO->getSection ();
64
- return IsPrefix (Name, " .ltext" );
65
- }
55
+ if (!GV)
66
56
return getCodeModel () == CodeModel::Large;
67
- }
68
57
69
58
if (GV->isThreadLocal ())
70
59
return false ;
@@ -84,8 +73,11 @@ bool TargetMachine::isLargeGlobalValue(const GlobalValue *GVal) const {
84
73
// data sections. The code model attribute overrides this above.
85
74
if (GV->hasSection ()) {
86
75
StringRef Name = GV->getSection ();
87
- return IsPrefix (Name, " .lbss" ) || IsPrefix (Name, " .ldata" ) ||
88
- IsPrefix (Name, " .lrodata" );
76
+ auto IsPrefix = [&](StringRef Prefix) {
77
+ StringRef S = Name;
78
+ return S.consume_front (Prefix) && (S.empty () || S[0 ] == ' .' );
79
+ };
80
+ return IsPrefix (" .lbss" ) || IsPrefix (" .ldata" ) || IsPrefix (" .lrodata" );
89
81
}
90
82
91
83
// Respect large data threshold for medium and large code models.
Original file line number Diff line number Diff line change 13
13
; RUN: llvm-readelf -S %t | FileCheck %s --check-prefix=LARGE-DS
14
14
15
15
; SMALL: .text {{.*}} AX {{.*}}
16
- ; SMALL: .ltext {{.*}} AXl {{.*}}
17
- ; SMALL: .ltext.2 {{.*}} AXl {{.*}}
18
- ; SMALL: .foo {{.*}} AX {{.*}}
19
16
; SMALL-DS: .text.func {{.*}} AX {{.*}}
20
- ; SMALL-DS: .ltext {{.*}} AXl {{.*}}
21
- ; SMALL-DS: .ltext.2 {{.*}} AXl {{.*}}
22
- ; SMALL-DS: .foo {{.*}} AX {{.*}}
23
17
; LARGE: .ltext {{.*}} AXl {{.*}}
24
- ; LARGE: .ltext.2 {{.*}} AXl {{.*}}
25
- ; LARGE: .foo {{.*}} AX {{.*}}
26
18
; LARGE-DS: .ltext.func {{.*}} AXl {{.*}}
27
- ; LARGE-DS: .ltext {{.*}} AXl {{.*}}
28
- ; LARGE-DS: .ltext.2 {{.*}} AXl {{.*}}
29
- ; LARGE-DS: .foo {{.*}} AX {{.*}}
30
19
31
20
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
32
21
target triple = "x86_64--linux"
33
22
34
23
define void @func () {
35
24
ret void
36
25
}
37
-
38
- define void @ltext () section ".ltext" {
39
- ret void
40
- }
41
-
42
- define void @ltext2 () section ".ltext.2" {
43
- ret void
44
- }
45
-
46
- define void @foo () section ".foo" {
47
- ret void
48
- }
You can’t perform that action at this time.
0 commit comments