File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
compiler/rustc_session/src Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -875,7 +875,21 @@ impl Session {
875
875
// As a result 16 was chosen here! Mostly because it was a power of 2
876
876
// and most benchmarks agreed it was roughly a local optimum. Not very
877
877
// scientific.
878
- CodegenUnits :: Default ( 16 )
878
+
879
+ if self . target . options . vendor == "solana" {
880
+ // Default to 1 for SBF programs. It makes a huge difference in
881
+ // terms of generated code size for us
882
+ // (https://github.com/rust-lang/rust/issues/47745) and compilation
883
+ // time isn't a huge concern (programs tend to be small). It's still
884
+ // possible to override this from the command line or from cargo
885
+ // profiles.
886
+ //
887
+ // Note that we don't set default_codegen_units in the target
888
+ // definition as that would break incremental compilation.
889
+ CodegenUnits :: Default ( 1 )
890
+ } else {
891
+ CodegenUnits :: Default ( 16 )
892
+ }
879
893
}
880
894
881
895
pub fn teach ( & self , code : ErrCode ) -> bool {
You can’t perform that action at this time.
0 commit comments