File tree 3 files changed +18
-5
lines changed 3 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -392,8 +392,12 @@ pub mod write {
392
392
}
393
393
// Clean up and return
394
394
395
- llvm:: LLVMDisposeModule ( llmod) ;
396
- llvm:: LLVMContextDispose ( llcx) ;
395
+ // Save some time by not destroying the LLVM module
396
+ if !sess. opts . leak_llvm {
397
+ llvm:: LLVMDisposeModule ( llmod) ;
398
+ llvm:: LLVMContextDispose ( llcx) ;
399
+ }
400
+
397
401
if sess. time_llvm_passes ( ) {
398
402
llvm:: LLVMRustPrintPassTimings ( ) ;
399
403
}
@@ -413,8 +417,12 @@ pub mod write {
413
417
}
414
418
}
415
419
416
- llvm:: LLVMDisposeModule ( llmod) ;
417
- llvm:: LLVMContextDispose ( llcx) ;
420
+ // Save some time by not destroying the LLVM module
421
+ if !sess. opts . leak_llvm {
422
+ llvm:: LLVMDisposeModule ( llmod) ;
423
+ llvm:: LLVMContextDispose ( llcx) ;
424
+ }
425
+
418
426
if sess. time_llvm_passes ( ) { llvm:: LLVMRustPrintPassTimings ( ) ; }
419
427
}
420
428
}
Original file line number Diff line number Diff line change @@ -762,7 +762,8 @@ pub fn build_session_options(binary: @str,
762
762
parse_only : parse_only,
763
763
no_trans : no_trans,
764
764
debugging_opts : debugging_opts,
765
- android_cross_path : android_cross_path
765
+ android_cross_path : android_cross_path,
766
+ leak_llvm : true
766
767
} ;
767
768
return sopts;
768
769
}
Original file line number Diff line number Diff line change @@ -166,6 +166,9 @@ pub struct options {
166
166
no_trans : bool ,
167
167
debugging_opts : uint ,
168
168
android_cross_path : Option < ~str > ,
169
+ // Destroying the LLVM module takes significant time. Standalone rustc
170
+ // will just leak it to save precious seconds.
171
+ leak_llvm : bool
169
172
}
170
173
171
174
pub struct crate_metadata {
@@ -350,6 +353,7 @@ pub fn basic_options() -> @options {
350
353
no_trans : false ,
351
354
debugging_opts : 0 u,
352
355
android_cross_path : None ,
356
+ leak_llvm : false
353
357
}
354
358
}
355
359
You can’t perform that action at this time.
0 commit comments