File tree 5 files changed +31
-1
lines changed
5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,10 @@ impl Environment for LinuxEnvironment {
41
41
true
42
42
}
43
43
44
+ fn supports_shared_llvm ( & self ) -> bool {
45
+ true
46
+ }
47
+
44
48
fn executable_extension ( & self ) -> & ' static str {
45
49
""
46
50
}
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ pub trait Environment {
60
60
61
61
fn supports_bolt ( & self ) -> bool ;
62
62
63
+ fn supports_shared_llvm ( & self ) -> bool ;
64
+
63
65
/// What is the extension of binary executables in this environment?
64
66
fn executable_extension ( & self ) -> & ' static str ;
65
67
Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ impl Environment for WindowsEnvironment {
65
65
false
66
66
}
67
67
68
+ fn supports_shared_llvm ( & self ) -> bool {
69
+ false
70
+ }
71
+
68
72
fn executable_extension ( & self ) -> & ' static str {
69
73
".exe"
70
74
}
Original file line number Diff line number Diff line change @@ -139,6 +139,16 @@ impl Bootstrap {
139
139
self
140
140
}
141
141
142
+ pub fn without_llvm_lto ( mut self ) -> Self {
143
+ self . cmd = self
144
+ . cmd
145
+ . arg ( "--set" )
146
+ . arg ( "llvm.thin-lto=false" )
147
+ . arg ( "--set" )
148
+ . arg ( "llvm.link-shared=true" ) ;
149
+ self
150
+ }
151
+
142
152
pub fn rustc_pgo_optimize ( mut self , profile : & RustcPGOProfile ) -> Self {
143
153
self . cmd = self . cmd . arg ( "--rust-profile-use" ) . arg ( profile. 0 . as_str ( ) ) ;
144
154
self
Original file line number Diff line number Diff line change @@ -38,7 +38,17 @@ fn execute_pipeline(
38
38
let rustc_profile_dir_root = env. opt_artifacts ( ) . join ( "rustc-pgo" ) ;
39
39
40
40
stage. section ( "Build PGO instrumented rustc and LLVM" , |section| {
41
- Bootstrap :: build ( env) . rustc_pgo_instrument ( & rustc_profile_dir_root) . run ( section)
41
+ let mut builder = Bootstrap :: build ( env) . rustc_pgo_instrument ( & rustc_profile_dir_root) ;
42
+
43
+ if env. supports_shared_llvm ( ) {
44
+ // This first LLVM that we build will be thrown away after this stage, and it
45
+ // doesn't really need LTO. Without LTO, it builds in ~1 minute thanks to sccache,
46
+ // with LTO it takes almost 10 minutes. It makes the followup Rustc PGO
47
+ // instrumented/optimized build a bit slower, but it seems to be worth it.
48
+ builder = builder. without_llvm_lto ( ) ;
49
+ }
50
+
51
+ builder. run ( section)
42
52
} ) ?;
43
53
44
54
let profile = stage
You can’t perform that action at this time.
0 commit comments